aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/locale.conf2
-rw-r--r--core/locales/locale.de.conf2
-rw-r--r--core/locales/locale.es.conf2
-rw-r--r--core/locales/locale.fr.conf2
-rw-r--r--core/locales/locale.ru.conf2
-rw-r--r--modules/textadept/editing.lua22
-rw-r--r--modules/textadept/keys.lua10
-rw-r--r--modules/textadept/menu.lua3
8 files changed, 10 insertions, 35 deletions
diff --git a/core/locale.conf b/core/locale.conf
index 0b3486e7..40bd6945 100644
--- a/core/locale.conf
+++ b/core/locale.conf
@@ -159,8 +159,6 @@ Enclose in _Double Quotes = Enclose in _Double Quotes
Enclose in _Parentheses = Enclose in _Parentheses
Enclose in _Brackets = Enclose in _Brackets
Enclose in B_races = Enclose in B_races
-_Grow Selection = _Grow Selection
-_Shrink Selection = _Shrink Selection
_Move Selected Lines Up = _Move Selected Lines Up
Move Selected Lines Do_wn = Move Selected Lines Do_wn
_Search = _Search
diff --git a/core/locales/locale.de.conf b/core/locales/locale.de.conf
index 2fd53632..2508a656 100644
--- a/core/locales/locale.de.conf
+++ b/core/locales/locale.de.conf
@@ -149,8 +149,6 @@ Enclose in _Double Quotes = In doppelten Anführungszeichen
Enclose in _Parentheses = In runden Klammern
Enclose in _Brackets = In eckigen Klammern
Enclose in B_races = In geschweiften Klammern
-_Grow Selection = Markierung vergrößern
-_Shrink Selection = Markierung verkleinern
_Move Selected Lines Up = Markierte Zeilen nach unten verschieben
Move Selected Lines Do_wn = Markierte Zeilen nach oben verschieben
_Search = _Suche
diff --git a/core/locales/locale.es.conf b/core/locales/locale.es.conf
index 75cebba6..a8a1c628 100644
--- a/core/locales/locale.es.conf
+++ b/core/locales/locale.es.conf
@@ -160,8 +160,6 @@ Enclose in _Double Quotes = Del_imitar por comillas dobles
Enclose in _Parentheses = Deli_mitar por paréntesis
Enclose in _Brackets = Delimi_tar por corchetes
Enclose in B_races = Delimit_ar por llaves
-_Grow Selection = E_xtender selección
-_Shrink Selection = Enc_oger selección
_Move Selected Lines Up = Mover lí_neas seleccionadas arriba
Move Selected Lines Do_wn = Mo_ver líneas seleccionadas abajo
_Search = _Buscar
diff --git a/core/locales/locale.fr.conf b/core/locales/locale.fr.conf
index 42d9f5b1..ad2be4d8 100644
--- a/core/locales/locale.fr.conf
+++ b/core/locales/locale.fr.conf
@@ -160,8 +160,6 @@ Enclose in _Double Quotes = Entre guillemets
Enclose in _Parentheses = Entre _parenthèses
Enclose in _Brackets = Entre _crochets
Enclose in B_races = Entre acc_olades
-_Grow Selection = _Agrandir la sélection
-_Shrink Selection = _Réduire la sélection
_Move Selected Lines Up = _Déplacer les lignes sélectionnées vers le haut
Move Selected Lines Do_wn = Déplacer les lignes sélectionnées vers le _bas
_Search = _Recherche
diff --git a/core/locales/locale.ru.conf b/core/locales/locale.ru.conf
index 9880a32e..e4b48db6 100644
--- a/core/locales/locale.ru.conf
+++ b/core/locales/locale.ru.conf
@@ -149,8 +149,6 @@ Enclose in _Double Quotes = Заключить в _двойные кавычки
Enclose in _Parentheses = Заключить в к_руглые скобки
Enclose in _Brackets = Заключить в к_вадратные скобки
Enclose in B_races = Заключить в _фигурные скобки
-_Grow Selection = _Увеличить выделение
-_Shrink Selection = У_меньшить выделение
_Move Selected Lines Up = Переместить выделенные строки _вверх
Move Selected Lines Do_wn = Переместить выделнные строки в_низ
_Search = _Поиск
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index eb9aa8c5..59799709 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -381,28 +381,20 @@ end
---
-- Selects the text in-between strings *left* and *right* containing the caret.
+-- If already selected, toggles between selecting the *left* and *right*
+-- enclosures too.
-- @param left The left part of the enclosure.
-- @param right The right part of the enclosure.
-- @name select_enclosed
function M.select_enclosed(left, right)
local buffer = buffer
+ local anchor, pos = buffer.anchor, buffer.current_pos
+ if anchor ~= pos then buffer:goto_pos(pos - #right) end
buffer:search_anchor()
local s, e = buffer:search_prev(0, left), buffer:search_next(0, right)
- if s >= 0 and e >= 0 then buffer:set_sel(s + 1, e) end
-end
-
----
--- Grows the selected text by *amount* number of characters on either end.
--- @param amount The number of characters to grow the selection by on either
--- end.
--- @name grow_selection
-function M.grow_selection(amount)
- local buffer = buffer
- local anchor, pos = buffer.anchor, buffer.current_pos
- if anchor < pos then
- buffer:set_sel(anchor - amount, pos + amount)
- else
- buffer:set_sel(anchor + amount, pos - amount)
+ if s >= 0 and e >= 0 then
+ if s + #left == anchor and e == pos then s, e = s - #left, e + #right end
+ buffer:set_sel(s + #left, e)
end
end
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index e87bed56..e88bbb6e 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -63,8 +63,6 @@ local M = {}
-- Alt+( |^( |M-) |Enclose in parentheses
-- Alt+[ |^[ |M-] |Enclose in brackets
-- Alt+{ |^{ |M-} |Enclose in braces
--- Ctrl++ |⌘+ |M-+ |Grow selection bounds by 1
--- Ctrl+\_ |⌘\_ |M-\_ |Shrink selection bounds by 1
-- Ctrl+Shift+Up |^⇧⇡ |S-^Up |Move selected lines up
-- Ctrl+Shift+Down |^⇧⇣ |S-^Down |Move selected lines down
-- **Search** | | |
@@ -312,7 +310,7 @@ local utils = M.utils
-- Windows and Linux key bindings.
--
-- Unassigned keys (~ denotes keys reserved by the operating system):
--- c: A B C H p Q ~ V X Y ) ] }
+-- c: A B C H p Q ~ V X Y _ ) ] } +
-- a: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_ ) ] } *+-/=\n\s
-- ca: aAbBcCdD F jJkKlLmM N PqQ t xXy zZ_"'()[]{}<>* / \s
--
@@ -327,7 +325,7 @@ local utils = M.utils
-- Mac OSX key bindings.
--
-- Unassigned keys (~ denotes keys reserved by the operating system):
--- m: A B C ~ JkK ~M p ~ t U V XyY ) ] } ~~\n
+-- m: A B C ~ JkK ~M p ~ t U V XyY _ ) ] } + ~~\n
-- c: cC D gG H J K L oO qQ xXyYzZ_ ) ] } * /
-- cm: aAbBcC~D F ~HiIjJkKlL~MnN pPq~rRsStTuUvVwWxXyYzZ_"'()[]{}<>*+-/=\t\n
--
@@ -355,7 +353,7 @@ local utils = M.utils
-- Unassigned keys (~ denotes keys reserved by the operating system):
-- c: g~~ ~
-- cm: bcd g~~ k ~ pq t v xyz
--- m: e J qQ sS u vVw yYzZ
+-- m: e J qQ sS u vVw yYzZ_ +
-- Note: m[befhstv] may be used by Linux/BSD GUI terminals for menu access.
--
-- CTRL = 'c' (Control ^)
@@ -439,8 +437,6 @@ keys[not OSX and (not CURSES and 'a[' or 'm]')
or 'c['] = {m_editing.enclose, '[', ']'}
keys[not OSX and (not CURSES and 'a{' or 'm}')
or 'c{'] = {m_editing.enclose, '{', '}'}
-keys[not OSX and not CURSES and 'c+' or 'm+'] = {m_editing.grow_selection, 1}
-keys[not OSX and not CURSES and 'c_' or 'm_'] = {m_editing.grow_selection, -1}
keys.csup = buffer.move_selected_lines_up
keys.csdown = buffer.move_selected_lines_down
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 5dc77735..3115bdea 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -93,9 +93,6 @@ local menubar = {
{_L['Enclose in _Brackets'], {m_editing.enclose, '[', ']'}},
{_L['Enclose in B_races'], {m_editing.enclose, '{', '}'}},
SEPARATOR,
- {_L['_Grow Selection'], {m_editing.grow_selection, 1}},
- {_L['_Shrink Selection'], {m_editing.grow_selection, -1}},
- SEPARATOR,
{_L['_Move Selected Lines Up'], buffer.move_selected_lines_up},
{_L['Move Selected Lines Do_wn'], buffer.move_selected_lines_down},
},