diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-01-28 16:45:25 -0500 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2014-01-28 16:45:25 -0500 |
commit | 1744b49f5492485f15374976462d0b483186d975 (patch) | |
tree | d481fe8def77612eefab29ae018c21f3b5ef734a | |
parent | 627d17be87dbd1f93dba9640cfc6b55ba329fc9d (diff) |
Fixed bug with restoring views in buffers with word wrap enabled; core/ui.lua
-rw-r--r-- | core/ui.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/ui.lua b/core/ui.lua index fa2d5d51..4272055d 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -328,7 +328,7 @@ events_connect(events.BUFFER_BEFORE_SWITCH, function() local buffer = buffer -- Save view state. buffer._anchor, buffer._current_pos = buffer.anchor, buffer.current_pos - buffer._first_visible_line = buffer.first_visible_line + buffer._top_line = buffer:doc_line_from_visible(buffer.first_visible_line) -- Save fold state. buffer._folds = {} local folds, i = buffer._folds, buffer:contracted_fold_next(0) @@ -345,9 +345,8 @@ events_connect(events.BUFFER_AFTER_SWITCH, function() for i = 1, #buffer._folds do buffer:toggle_fold(buffer._folds[i]) end -- Restore view state. buffer:set_sel(buffer._anchor, buffer._current_pos) - buffer:line_scroll(0, - buffer:visible_from_doc_line(buffer._first_visible_line) - - buffer.first_visible_line) + buffer:line_scroll(0, buffer:visible_from_doc_line(buffer._top_line) - + buffer.first_visible_line) end) -- Updates titlebar and statusbar. |