lib/vedeu/editor/document.rb in vedeu-0.6.40 vs lib/vedeu/editor/document.rb in vedeu-0.6.41

- old
+ new

@@ -62,10 +62,11 @@ else @lines = lines.delete_character(y, x - 1) left + end end # Delete a line. # @@ -74,10 +75,12 @@ @lines = lines.delete_line(y) up eol + + refresh end # Returns the document as a string with line breaks if there is # more than one line. # @@ -103,10 +106,12 @@ return self if character.is_a?(Symbol) @lines = lines.insert_character(character, y, x) right + + refresh end # Insert an empty line. # # @return [Vedeu::Editor::Document] @@ -114,10 +119,12 @@ @lines = lines.insert_line(y + 1) down bol + + refresh end # Returns the current line from the collection of lines. # # @return [Array<String|void>] @@ -164,33 +171,29 @@ # # @return [Vedeu::Editor::Document] def left return self if x - 1 < 0 - cursor.left - - refresh + cursor.left.refresh end # Move the virtual cursor right. # # @return [Vedeu::Editor::Document] def right return self if x + 1 > line.size - cursor.right - - refresh + cursor.right.refresh end # Move the virtual cursor up. # # @return [Vedeu::Editor::Document] def up return self if y - 1 < 0 - cursor.up + cursor.up.refresh if x > line(y).size eol else @@ -203,11 +206,11 @@ # # @return [Vedeu::Editor::Document] def down return self if y + 1 >= lines.size - cursor.down + cursor.down.refresh if x > line(y).size eol else @@ -218,21 +221,19 @@ # Move the virtual cursor to the beginning of the line. # # @return [Vedeu::Editor::Document] def bol - cursor.bol - - refresh + cursor.bol.refresh end # Move the virtual cursor to the end of the line. # # @return [Vedeu::Editor::Document] def eol cursor.x = line.size - refresh + cursor.refresh end private # Returns the default options/attributes for this class.