aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ext/key_commands.lua22
-rw-r--r--core/ext/menu.lua16
-rw-r--r--core/locale.conf28
-rw-r--r--modules/textadept/init.lua1
-rw-r--r--modules/textadept/mlines.lua146
-rw-r--r--themes/dark/buffer.lua1
-rw-r--r--themes/light/buffer.lua1
-rw-r--r--themes/scite/buffer.lua1
8 files changed, 5 insertions, 211 deletions
diff --git a/core/ext/key_commands.lua b/core/ext/key_commands.lua
index a036ecbe..738199e6 100644
--- a/core/ext/key_commands.lua
+++ b/core/ext/key_commands.lua
@@ -114,7 +114,7 @@ if not MAC then
-- Windows and Linux key commands.
--[[
- C: B D H I J K L U
+ C: B D H I J K L M U
A: A B C D E F G H J K L M N P R S T U V W X Y Z
CS: A B C D G H I J K L M N O Q T U V X Y Z
SA: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@@ -212,15 +212,6 @@ if not MAC then
keys.cai = { m_snippets.cancel_current }
keys.caI = { m_snippets.list }
keys.ai = { m_snippets.show_style }
- -- Multiple Line Editing
- local m_mlines = _m.textadept.mlines
- keys.cm = {}
- keys.cm.a = { m_mlines.add }
- keys.cm.A = { m_mlines.add_multiple }
- keys.cm.r = { m_mlines.remove }
- keys.cm.R = { m_mlines.remove_multiple }
- keys.cm.u = { m_mlines.update }
- keys.cm.c = { m_mlines.clear }
-- Buffers
keys['c\t'] = { 'goto_buffer', v, 1, false }
@@ -299,7 +290,7 @@ else
-- Mac OSX key commands
--[[
- C: J L U W X Z
+ C: J L M U W X Z
A: B D E H J K L U
CS: C D G H I J K L M O Q S T U V W X Y Z
SA: A B C D H I J K L M N O Q R T U V X
@@ -401,15 +392,6 @@ else
keys.cai = { m_snippets.cancel_current }
keys.caI = { m_snippets.list }
keys.ci = { m_snippets.show_style }
- -- Multiple Line Editing
- local m_mlines = _m.textadept.mlines
- keys.am = {}
- keys.am.a = { m_mlines.add }
- keys.am.A = { m_mlines.add_multiple }
- keys.am.r = { m_mlines.remove }
- keys.am.R = { m_mlines.remove_multiple }
- keys.am.u = { m_mlines.update }
- keys.am.c = { m_mlines.clear }
-- Buffers
keys['c\t'] = { 'goto_buffer', v, 1, false }
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index d0577fe1..0bb92a07 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -232,14 +232,6 @@ local menubar = {
{ l.MENU_TOOLS_SNIPPETS_LIST, ID.LIST_SNIPPETS },
{ l.MENU_TOOLS_SNIPPETS_SHOW_SCOPE, ID.SHOW_SCOPE },
},
- { title = l.MENU_TOOLS_ML_TITLE,
- { l.MENU_TOOLS_ML_ADD, ID.ADD_MULTIPLE_LINE },
- { l.MENU_TOOLS_ML_ADD_MULTIPLE, ID.ADD_MULTIPLE_LINES },
- { l.MENU_TOOLS_ML_REMOVE, ID.REMOVE_MULTIPLE_LINE },
- { l.MENU_TOOLS_ML_REMOVE_MULTIPLE, ID.REMOVE_MULTIPLE_LINES },
- { l.MENU_TOOLS_ML_UPDATE, ID.UPDATE_MULTIPLE_LINES },
- { l.MENU_TOOLS_ML_FINISH, ID.FINISH_MULTIPLE_LINES },
- },
{ title = l.MENU_TOOLS_BM_TITLE,
{ l.MENU_TOOLS_BM_TOGGLE, ID.TOGGLE_BOOKMARK },
{ l.MENU_TOOLS_BM_CLEAR_ALL, ID.CLEAR_BOOKMARKS },
@@ -311,7 +303,6 @@ t.menubar = menubar
local b, v = 'buffer', 'view'
local m_snippets = _m.textadept.lsnippets
local m_editing = _m.textadept.editing
-local m_mlines = _m.textadept.mlines
local m_bookmarks = _m.textadept.bookmarks
local m_run = _m.textadept.run
@@ -463,13 +454,6 @@ local actions = {
[ID.CANCEL_SNIPPET] = { m_snippets.cancel_current },
[ID.LIST_SNIPPETS] = { m_snippets.list },
[ID.SHOW_SCOPE] = { m_snippets.show_style },
- -- Tools -> Multiple Line Editing
- [ID.ADD_MULTIPLE_LINE] = { m_mlines.add },
- [ID.ADD_MULTIPLE_LINES] = { m_mlines.add_multiple },
- [ID.REMOVE_MULTIPLE_LINE] = { m_mlines.remove },
- [ID.REMOVE_MULTIPLE_LINES] = { m_mlines.remove_multiple },
- [ID.UPDATE_MULTIPLE_LINES] = { m_mlines.update },
- [ID.FINISH_MULTIPLE_LINES] = { m_mlines.clear },
-- Tools -> Bookmark
[ID.TOGGLE_BOOKMARK] = { m_bookmarks.toggle },
[ID.CLEAR_BOOKMARKS] = { m_bookmarks.clear },
diff --git a/core/locale.conf b/core/locale.conf
index 07df3bc7..e6595a53 100644
--- a/core/locale.conf
+++ b/core/locale.conf
@@ -464,34 +464,6 @@ MENU_TOOLS_SNIPPETS_LIST "_List"
MENU_TOOLS_SNIPPETS_SHOW_SCOPE "_Show Scope"
% core/ext/menu.lua
-% "_Multiple Line Editing"
-MENU_TOOLS_ML_TITLE "_Multiple Line Editing"
-
-% core/ext/menu.lua
-% "_Add Line"
-MENU_TOOLS_ML_ADD "_Add Line"
-
-% core/ext/menu.lua
-% "Add _Multiple Lines"
-MENU_TOOLS_ML_ADD_MULTIPLE "Add _Multiple Lines"
-
-% core/ext/menu.lua
-% "_Remove Line"
-MENU_TOOLS_ML_REMOVE "_Remove Line"
-
-% core/ext/menu.lua
-% "R_emove Multiple Lines"
-MENU_TOOLS_ML_REMOVE_MULTIPLE "R_emove Multiple Lines"
-
-% core/ext/menu.lua
-% "_Update Multiple Lines"
-MENU_TOOLS_ML_UPDATE "_Update Multiple Lines"
-
-% core/ext/menu.lua
-% "_Finish Editing"
-MENU_TOOLS_ML_FINISH "_Finish Editing"
-
-% core/ext/menu.lua
% "_Bookmark"
MENU_TOOLS_BM_TITLE "_Bookmark"
diff --git a/modules/textadept/init.lua b/modules/textadept/init.lua
index e51e5bf0..b07a47c7 100644
--- a/modules/textadept/init.lua
+++ b/modules/textadept/init.lua
@@ -8,6 +8,5 @@ module('_m.textadept', package.seeall)
require 'textadept.bookmarks'
require 'textadept.editing'
require 'textadept.lsnippets'
-require 'textadept.mlines'
require 'textadept.run'
require 'textadept.session'
diff --git a/modules/textadept/mlines.lua b/modules/textadept/mlines.lua
deleted file mode 100644
index 4db0949e..00000000
--- a/modules/textadept/mlines.lua
+++ /dev/null
@@ -1,146 +0,0 @@
--- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-
-local textadept = _G.textadept
-local locale = _G.locale
-
----
--- Multiple line editing for the textadept module.
-module('_m.textadept.mlines', package.seeall)
-
--- Markdown:
--- ## Settings
---
--- * `MARK_MLINE`: The unique integer mark used to identify an MLine marked
--- line.
--- * `MARK_MLINE_COLOR`: The [Scintilla color][scintilla_color] used for an
--- MLine marked line.
---
--- [scintilla_color]: http://scintilla.org/ScintillaDoc.html#colour
-
--- settings
-MARK_MLINE = 2
-MARK_MLINE_COLOR = 0x4D994D
--- end settings
-
--- Contains all MLine marked lines with the column index to edit with respect to
--- for each specific line.
-local mlines = {}
-
-local mlines_most_recent
-
----
--- Adds an mline marker to the current line and stores the line number and
--- column position of the caret in the mlines table.
-function add()
- local buffer = buffer
- local column = buffer.column[buffer.current_pos]
- local line = buffer:line_from_position(buffer.current_pos)
- local new_marker = buffer:marker_add(line, MARK_MLINE)
- mlines[line] = { marker = new_marker, start_col = column }
- mlines_most_recent = line
-end
-
----
--- Adds mline markers to all lines from the most recently added line to the
--- current line.
--- The mlines table is updated as in add(), but all column positions are the
--- same as the current column caret position.
-function add_multiple()
- local buffer = buffer
- if mlines_most_recent then
- local line = buffer:line_from_position(buffer.current_pos)
- local column = buffer.column[buffer.current_pos]
- local start_line, end_line
- if mlines_most_recent < line then
- start_line, end_line = mlines_most_recent, line
- else
- start_line, end_line = line, mlines_most_recent
- end
- for curr_line = start_line, end_line do
- local new_mark = buffer:marker_add(curr_line, MARK_MLINE)
- mlines[curr_line] = { marker = new_mark, start_col = column }
- end
- mlines_most_recent = line
- end
-end
-
----
--- Clears the mline marker at the current line.
-function remove()
- local buffer = buffer
- local line = buffer:line_from_position(buffer.current_pos)
- buffer:marker_delete(line, MARK_MLINE)
- mlines[line] = nil
-end
-
----
--- Clears the mline markers from the line whose marker was most recently
--- removed (or the line where a marker was most recently added to) to the
--- current line.
-function remove_multiple()
- local buffer = buffer
- if mlines_most_recent then
- local line = buffer:line_from_position(buffer.current_pos)
- local start_line, end_line
- if mlines_most_recent < line then
- start_line, end_line = mlines_most_recent, line
- else
- start_line, end_line = line, mlines_most_recent
- end
- for curr_line = start_line, end_line do
- buffer:marker_delete(curr_line, MARK_MLINE)
- mlines[curr_line] = nil
- end
- mlines_most_recent = line
- end
-end
-
----
--- Clears all mline markers and the mlines table.
-function clear()
- local buffer = buffer
- buffer:marker_delete_all(MARK_MLINE)
- mlines = {}
- mlines_most_recent = nil
-end
-
----
--- Applies changes made in the current line relative to the caret column
--- position stored initially to all lines with mline markers in relation to
--- their initial column positions.
-function update()
- local buffer = buffer
- local curr_line = buffer:line_from_position(buffer.current_pos)
- local curr_col = buffer.column[buffer.current_pos]
- buffer:begin_undo_action()
- if mlines[curr_line] then
- local s = buffer:find_column(curr_line, mlines[curr_line].start_col)
- local e = buffer:find_column(curr_line, curr_col)
- local delta = e - s
- local txt = ''
- if delta > 0 then txt = buffer:text_range(s, e) end
- for line_num, item in pairs(mlines) do
- if line_num ~= curr_line then
- local next_pos = buffer:find_column(line_num, item.start_col)
- if delta < 0 then
- buffer.current_pos, buffer.anchor = next_pos, next_pos
- for i = 1, math.abs(delta) do buffer:delete_back() end
- item.start_col = buffer.column[buffer.current_pos]
- else
- buffer:insert_text(next_pos, txt)
- item.start_col = item.start_col + #txt
- end
- end
- end
- if delta < 0 then
- local pos = buffer:position_from_line(curr_line) + curr_col
- buffer:goto_pos(pos)
- end
- mlines[curr_line].start_col = curr_col
- end
- buffer:end_undo_action()
-end
-
-if buffer then buffer:marker_set_back(MARK_MLINE, MARK_MLINE_COLOR) end
-textadept.events.add_handler('view_new',
- function() buffer:marker_set_back(MARK_MLINE, MARK_MLINE_COLOR) end)
diff --git a/themes/dark/buffer.lua b/themes/dark/buffer.lua
index a1863089..cd2c8ce5 100644
--- a/themes/dark/buffer.lua
+++ b/themes/dark/buffer.lua
@@ -18,3 +18,4 @@ buffer.indentation_guides = 1
-- various
buffer.auto_c_choose_single = true
+buffer.additional_selection_typing = true
diff --git a/themes/light/buffer.lua b/themes/light/buffer.lua
index 8b2dabd1..8f2c22dd 100644
--- a/themes/light/buffer.lua
+++ b/themes/light/buffer.lua
@@ -18,3 +18,4 @@ buffer.indentation_guides = 1
-- various
buffer.auto_c_choose_single = true
+buffer.additional_selection_typing = true
diff --git a/themes/scite/buffer.lua b/themes/scite/buffer.lua
index ef1a3d67..92e5dea8 100644
--- a/themes/scite/buffer.lua
+++ b/themes/scite/buffer.lua
@@ -18,3 +18,4 @@ buffer.indentation_guides = 1
-- various
buffer.auto_c_choose_single = true
+buffer.additional_selection_typing = true