Ejemplo n.º 1
0
 def kill(self):
     'Delete line from point to end-of-line'
     killed_segment = self.line[self.point:]
     if killed_segment: # Do not overwrite yank buffer with empty segment
         self.yank_buffer = killed_segment
     self.line = self.line[:self.point] # point does not change
     display.kill_line()
Ejemplo n.º 2
0
 def redraw(self):
     'redraw line'
     # Maybe ^L on vt should refresh whole window or even whole frame?
     display.move_to_column(self.start_col)
     self.point = len(self.line)
     util.putstr(self.line)
     display.kill_line() # remove any leftover text past self.line
Ejemplo n.º 3
0
 def cancel_eden_command(self):
     'After execute() above, just discard the line, then return to display mode.'
     self.collecting_command = False
     # self.process_command()
     # next two lines from discard method
     self.move_beginning()
     display.kill_line()
     terminal.set_char_mode()
     self.display_mode(ed.buf.lines[ed.buf.dot].rstrip()) # strip \n at eol
Ejemplo n.º 4
0
 def discard(self): # name like gnu readline unix-line-discard
     'Delete line from start-of-line to point'
     killed_segment = self.line[:self.point]
     if killed_segment: # Do not overwrite yank buffer with empty segment
         self.yank_buffer = killed_segment
     self.line = self.line[self.point:]
     self.move_beginning() # accounts for prompt, assigns point
     util.putstr(self.line)
     display.kill_line() # remove any leftover text past self.line
     self.move_beginning() # replace cursor again
Ejemplo n.º 5
0
 def display_lines(self, first, last):
     """
     Print lines in buffer numbered first through last.
     Assumes cursor already positioned at first line.
     """
     for line in self.buf.lines[first:last+1]: # slice, upper limit excluded
         # remove \n, truncate don't wrap
         print(line.rstrip()[:self.ncols-1], end=' ') 
         display.kill_line() # erase from cursor to end
         print() # advance to next line
Ejemplo n.º 6
0
 def open_line(self):
     """
     Split line at point, replace line in buffer at dot
     with its prefix, append suffix after line at dot.
     """
     prefix = self.line[:self.point]
     suffix = self.line[self.point:].rstrip()
     ed.buf.replace(ed.buf.dot, prefix + '\n')
     display.kill_line() # from cursor to end of line
     ed.buf.a(ed.buf.dot, suffix + '\n') # calls update(Op.insert ...)
     self.line = suffix
     self.point = 0
     self.start_col = 1
     frame.put_display_cursor()
     
     # buf.a() update moved cursor so we have to put it back.FIXME?Redundant?
     win = frame.win
     wdot = win.wline(win.buf.dot)
     display.put_cursor(wdot,1)
Ejemplo n.º 7
0
 def redraw(self):
     'Refresh line'
     display.move_to_column(self.start_col)
     self.point = len(self.line)
     util.putstr(self.line)
     display.kill_line() # remove any leftover text past self.line
Ejemplo n.º 8
0
 def discard(self): # name like gnu readline unix-line-discard
     'discard line'
     self.line = str() 
     self.move_beginning() # accounts for prompt, assigns point
     display.kill_line() # erase from cursor to end of line
Ejemplo n.º 9
0
 def kill(self):
     'delete line from point to end-of-line'
     self.line = self.line[:self.point] # point does not change
     display.kill_line()