def _get_pos_selection_from_app(self):
     """retrieves current position of cursor and the range of 
     current selection directly from the external application
     
     **INPUTS**
     
     *none*
     
     **OUTPUTS**
     
     *(INT, (INT, INT))* (pos, (start, end))
     
     pos is the offset into buffer of current cursor position
     start is the offset into the buffer of the start of the current
     selection.  end is the offset into the buffer of the character 
     following the selection (this matches Python's slice convention).
     """
     self.app.talk_msgr.send_mess('get_pos_selection',
                                  {'buff_name': self.name()})
     response = self.app.talk_msgr.get_mess(
         expect=['get_pos_selection_resp'])
     value = response[1]['value']
     trace('SourceBuffMessaging._get_pos_selection_from_app',
           'value = %s' % value)
     pos = messaging.messarg2int(value['pos'])
     trace('SourceBuffMessaging._get_pos_selection_from_app',
           'pos = %d' % pos)
     selection = messaging.messarg2inttuple(value['selection'])
     trace('SourceBuffMessaging._get_pos_selection_from_app',
           'selection = %s' % repr(selection))
     return (pos, selection)
Esempio n. 2
0
 def cmd_set_selection(self, arguments):
     buff_name = arguments['buff_name']
     range = messaging.messarg2inttuple(arguments['range'])
     cursor_at = messaging.messarg2int(arguments['cursor_at'])
     self.editor.set_selection(range, cursor_at, buff_name=buff_name)
     updates = self.pos_selection_update(buff_name)
     self.send_updates_response('set_selection_resp', updates)
 def _get_pos_selection_from_app(self):
     """retrieves current position of cursor and the range of 
     current selection directly from the external application
     
     **INPUTS**
     
     *none*
     
     **OUTPUTS**
     
     *(INT, (INT, INT))* (pos, (start, end))
     
     pos is the offset into buffer of current cursor position
     start is the offset into the buffer of the start of the current
     selection.  end is the offset into the buffer of the character 
     following the selection (this matches Python's slice convention).
     """
     self.app.talk_msgr.send_mess('get_pos_selection',
         {'buff_name': self.name()})
     response = self.app.talk_msgr.get_mess(expect=['get_pos_selection_resp'])
     value = response[1]['value']
     trace('SourceBuffMessaging._get_pos_selection_from_app',
         'value = %s' % value)
     pos = messaging.messarg2int(value['pos'])
     trace('SourceBuffMessaging._get_pos_selection_from_app',
         'pos = %d' % pos)
     selection = messaging.messarg2inttuple(value['selection'])
     trace('SourceBuffMessaging._get_pos_selection_from_app',
         'selection = %s' % repr(selection))
     return (pos, selection)
Esempio n. 4
0
 def cmd_set_selection(self, arguments):
     buff_name = arguments['buff_name']
     range = messaging.messarg2inttuple(arguments['range'])
     cursor_at = messaging.messarg2int(arguments['cursor_at'])
     self.editor.set_selection(range, cursor_at, buff_name = buff_name)
     updates =  self.pos_selection_update(buff_name)
     self.send_updates_response('set_selection_resp', updates)
Esempio n. 5
0
 def cmd_delete(self, arguments):
     buff_name = arguments['buff_name']
     range = messaging.messarg2inttuple(arguments['range'])
     self.awaiting_response = []
     b_name = buff_name
     if b_name == None:
         b_name = self.editor.curr_buffer()
     self.editor.delete(range, buff_name=buff_name)
     self.editor.print_buff_if_necessary(buff_name=buff_name)
     updates = self.awaiting_response
     self.awaiting_response = None
     updates = updates + self.pos_selection_update(b_name)
     self.send_updates_response('delete_resp', updates)
Esempio n. 6
0
 def cmd_delete(self, arguments):
     buff_name = arguments['buff_name']
     range = messaging.messarg2inttuple(arguments['range'])
     self.awaiting_response = []
     b_name = buff_name
     if b_name == None:
         b_name = self.editor.curr_buffer()
     self.editor.delete(range, buff_name = buff_name)
     self.editor.print_buff_if_necessary(buff_name = buff_name)
     updates = self.awaiting_response
     self.awaiting_response = None
     updates = updates + self.pos_selection_update(b_name)
     self.send_updates_response('delete_resp', updates)
    def _get_visible_from_app(self):
        """ get start and end offsets of the currently visible region of
        the buffer.  End is the offset of the first character not
        visible (matching Python's slice convention)

        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* (start, end)
        """
        self.app.talk_msgr.send_mess('get_visible', {'buff_name': self.name()})
        response = self.app.talk_msgr.get_mess(expect=['get_visible_resp'])
        return messaging.messarg2inttuple(response[1]['value'])
Esempio n. 8
0
 def cmd_insert_indent(self, arguments):
     buff_name = arguments['buff_name']
     code_bef = arguments['code_bef']
     code_after = arguments['code_after']
     range = messaging.messarg2inttuple(arguments['range'])
     self.awaiting_response = []
     b_name = buff_name
     if b_name == None:
         b_name = self.editor.curr_buffer()
     self.editor.insert_indent(code_bef, code_after, range, 
         buff_name = buff_name)
     self.editor.print_buff_if_necessary(buff_name = buff_name)
     updates = self.awaiting_response
     self.awaiting_response = None
     updates = updates + self.pos_selection_update(b_name)
     self.send_updates_response('insert_indent_resp', updates)
    def _get_visible_from_app(self):
        """ get start and end offsets of the currently visible region of
        the buffer.  End is the offset of the first character not
        visible (matching Python's slice convention)

        **INPUTS**

        *none*

        **OUTPUTS**

        *INT* (start, end)
        """
        self.app.talk_msgr.send_mess('get_visible',
            {'buff_name': self.name()})
        response = self.app.talk_msgr.get_mess(expect=['get_visible_resp'])
        return messaging.messarg2inttuple(response[1]['value'])
Esempio n. 10
0
 def cmd_insert_indent(self, arguments):
     buff_name = arguments['buff_name']
     code_bef = arguments['code_bef']
     code_after = arguments['code_after']
     range = messaging.messarg2inttuple(arguments['range'])
     self.awaiting_response = []
     b_name = buff_name
     if b_name == None:
         b_name = self.editor.curr_buffer()
     self.editor.insert_indent(code_bef,
                               code_after,
                               range,
                               buff_name=buff_name)
     self.editor.print_buff_if_necessary(buff_name=buff_name)
     updates = self.awaiting_response
     self.awaiting_response = None
     updates = updates + self.pos_selection_update(b_name)
     self.send_updates_response('insert_indent_resp', updates)