diff options
-rw-r--r-- | core/ui.lua | 13 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 7 | ||||
-rw-r--r-- | properties.lua | 18 |
3 files changed, 28 insertions, 10 deletions
diff --git a/core/ui.lua b/core/ui.lua index efaa13f9..dec028bd 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -343,6 +343,13 @@ events_connect(events.BUFFER_BEFORE_SWITCH, function() -- Save view state. buffer._anchor, buffer._current_pos = buffer.anchor, buffer.current_pos buffer._top_line = buffer:doc_line_from_visible(buffer.first_visible_line) + buffer._view_eol, buffer._view_ws = buffer.view_eol, buffer.view_ws + buffer._wrap_mode = buffer.wrap_mode + buffer._margin_type_n, buffer._margin_width_n = {}, {} + for i = 0, 4 do + buffer._margin_type_n[i] = buffer.margin_type_n[i] + buffer._margin_width_n[i] = buffer.margin_width_n[i] + end -- Save fold state. buffer._folds = {} local folds, i = buffer._folds, buffer:contracted_fold_next(0) @@ -361,6 +368,12 @@ events_connect(events.BUFFER_AFTER_SWITCH, function() buffer:set_sel(buffer._anchor, buffer._current_pos) buffer:line_scroll(0, buffer:visible_from_doc_line(buffer._top_line) - buffer.first_visible_line) + buffer.view_eol, buffer.view_ws = buffer._view_eol, buffer._view_ws + buffer.wrap_mode = buffer._wrap_mode + for i = 0, 4 do + buffer.margin_type_n[i] = buffer._margin_type_n[i] + buffer.margin_width_n[i] = buffer._margin_width_n[i] + end end) -- Updates titlebar and statusbar. diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index cb27174f..19d0687d 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -165,6 +165,10 @@ local menubar = { {_L['UTF-1_6 Encoding'], {utils.set_encoding, 'UTF-16LE'}}, }, SEPARATOR, + {_L['Toggle View _EOL'], {utils.toggle_property, 'view_eol'}}, + {_L['Toggle _Wrap Mode'], {utils.toggle_property, 'wrap_mode'}}, + {_L['Toggle View White_space'], {utils.toggle_property, 'view_ws'}}, + SEPARATOR, {_L['Select _Lexer...'], textadept.file_types.select_lexer}, {_L['_Refresh Syntax Highlighting'], {buffer.colourise, buffer, 0, -1}}, }, @@ -181,11 +185,8 @@ local menubar = { SEPARATOR, {_L['Toggle Current _Fold'], utils.toggle_current_fold}, SEPARATOR, - {_L['Toggle View _EOL'], {utils.toggle_property, 'view_eol'}}, - {_L['Toggle _Wrap Mode'], {utils.toggle_property, 'wrap_mode'}}, {_L['Toggle Show In_dent Guides'], {utils.toggle_property, 'indentation_guides'}}, - {_L['Toggle View White_space'], {utils.toggle_property, 'view_ws'}}, {_L['Toggle _Virtual Space'], {utils.toggle_property, 'virtual_space_options', buffer.VS_USERACCESSIBLE}}, diff --git a/properties.lua b/properties.lua index d3362939..26454995 100644 --- a/properties.lua +++ b/properties.lua @@ -26,13 +26,13 @@ if CURSES and not (WIN32 or LINUX or BSD) then buffer.v_scroll_bar = false end --buffer.end_at_last_line = false -- Whitespace ---buffer.view_ws = buffer.WS_VISIBLEALWAYS +buffer.view_ws = buffer.WS_INVISIBLE --buffer.whitespace_size = --buffer.extra_ascent = --buffer.extra_descent = -- Line Endings ---buffer.view_eol = true +buffer.view_eol = false -- Caret and Selection Styles. --buffer.sel_eol_filled = true @@ -47,17 +47,21 @@ buffer.caret_line_visible = not CURSES and buffer ~= ui.command_entry --buffer.margin_left = --buffer.margin_right = -- Line Number Margin. +buffer.margin_type_n[0] = buffer.MARGIN_NUMBER local width = 4 * buffer:text_width(buffer.STYLE_LINENUMBER, '9') buffer.margin_width_n[0] = width + (not CURSES and 4 or 0) -- Marker Margin. buffer.margin_width_n[1] = not CURSES and 4 or 1 -buffer.margin_sensitive_n[1] = true -buffer.margin_cursor_n[1] = buffer.CURSORARROW -- Fold Margin. buffer.margin_width_n[2] = not CURSES and 12 or 1 buffer.margin_mask_n[2] = buffer.MASK_FOLDERS -buffer.margin_sensitive_n[2] = true -buffer.margin_cursor_n[2] = buffer.CURSORARROW +-- Other Margins. +for i = 1, 4 do + buffer.margin_type_n[i] = buffer.MARGIN_SYMBOL + buffer.margin_sensitive_n[i] = true + buffer.margin_cursor_n[i] = buffer.CURSORARROW + if i > 2 then buffer.margin_width_n[i] = 0 end +end -- Annotations. buffer.annotation_visible = buffer.ANNOTATION_BOXED @@ -157,7 +161,7 @@ buffer.automatic_fold = buffer.AUTOMATICFOLD_SHOW + buffer.AUTOMATICFOLD_CLICK + buffer.fold_flags = not CURSES and buffer.FOLDFLAG_LINEAFTER_CONTRACTED or 0 -- Line Wrapping. ---buffer.wrap_mode = buffer.WRAP_WORD +buffer.wrap_mode = buffer.WRAP_NONE --buffer.wrap_visual_flags = buffer.WRAPVISUALFLAG_MARGIN --buffer.wrap_visual_flags_location = buffer.WRAPVISUALFLAGLOC_END_BY_TEXT --buffer.wrap_indent_mode = buffer.WRAPINDENT_SAME |