Skip to content

Commit

Permalink
improv(api)!: case_insensitive -> case_sensitive
Browse files Browse the repository at this point in the history
Double negatives are awkward.
  • Loading branch information
ggandor committed Jun 23, 2022
1 parent 0a42c85 commit 5183894
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ For cross-window search, traversal mode is not supported.

```Lua
require('leap').setup {
case_insensitive = true,
case_sensitive = false,
highlight_unlabeled = false,
-- Leaving the appropriate list empty effectively disables "smart" mode,
-- and forces auto-jump to be on or off.
Expand Down
4 changes: 2 additions & 2 deletions doc/leap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ Setting multiple options via the `setup` function: >

Available options~

`case_insensitive = true`
`case_sensitive = false`

Ignore case in search patterns.
Whether to consider case in search patterns.

`highlight_unlabeled = false`

Expand Down
4 changes: 2 additions & 2 deletions fnl/leap/main.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Dynamic attributes
easy iteration through each subset of targets with a given successor
char separately."
(tset targets :sublists {})
(when opts.case_insensitive
(when-not opts.case_sensitive
(setmetatable targets.sublists
{:__index (fn [t k] (rawget t (k:lower)))
:__newindex (fn [t k v] (rawset t (k:lower) v))}))
Expand Down Expand Up @@ -674,7 +674,7 @@ B: Two labels occupy the same position (this can occur at EOL or window

(fn prepare-pattern [in1 ?in2]
(.. "\\V"
(if opts.case_insensitive "\\c" "\\C")
(if opts.case_sensitive "\\C" "\\c")
(in1:gsub "\\" "\\\\") ; backslash needs to be escaped even for \V
(match ?in2 ; but not here (no arbitrary input after this)
spec-keys.eol (.. "\\(" ?in2 "\\|\\r\\?\\n\\)")
Expand Down
2 changes: 1 addition & 1 deletion fnl/leap/opts.fnl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:case_insensitive true
{:case_sensitive false
:highlight_unlabeled false
:safe_labels ["s" "f" "n"
"u" "t"
Expand Down
12 changes: 6 additions & 6 deletions lua/leap/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ local function get_targets(pattern, _78_)
local line = _each_87_[1]
local col = _each_87_[2]
local _88_ = vim.fn.screenpos(winid, line, col)
if ((_G.type(_88_) == "table") and ((_88_).col == col) and (nil ~= (_88_).row)) then
if ((_G.type(_88_) == "table") and (nil ~= (_88_).row) and ((_88_).col == col)) then
local row = (_88_).row
cursor_positions[winid] = {row, col}
else
Expand All @@ -540,7 +540,7 @@ local function get_targets(pattern, _78_)
local t = _each_92_
if by_screen_pos_3f then
local _95_ = vim.fn.screenpos(winid, line, col)
if ((_G.type(_95_) == "table") and ((_95_).col == col) and (nil ~= (_95_).row)) then
if ((_G.type(_95_) == "table") and (nil ~= (_95_).row) and ((_95_).col == col)) then
local row = (_95_).row
t["screenpos"] = {row, col}
else
Expand All @@ -561,7 +561,7 @@ local function get_targets(pattern, _78_)
end
local function populate_sublists(targets)
targets["sublists"] = {}
if opts.case_insensitive then
if not opts.case_sensitive then
local function _101_(t, k)
return rawget(t, k:lower())
end
Expand Down Expand Up @@ -893,10 +893,10 @@ local function leap(_161_)
spec_keys = setmetatable({}, {__index = _170_})
local function prepare_pattern(in1, _3fin2)
local function _171_()
if opts.case_insensitive then
return "\\c"
else
if opts.case_sensitive then
return "\\C"
else
return "\\c"
end
end
local function _173_()
Expand Down
2 changes: 1 addition & 1 deletion lua/leap/opts.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return {case_insensitive = true, highlight_unlabeled = false, safe_labels = {"s", "f", "n", "u", "t", "/", "F", "L", "N", "H", "G", "M", "U", "T", "?", "Z"}, labels = {"s", "f", "n", "j", "k", "l", "o", "d", "w", "e", "h", "m", "v", "g", "u", "t", "c", ".", "z", "/", "F", "L", "N", "H", "G", "M", "U", "T", "?", "Z"}, special_keys = {repeat_search = "<enter>", next_match = "<enter>", prev_match = "<tab>", next_group = "<space>", prev_group = "<tab>", eol = "<space>"}}
return {case_sensitive = false, highlight_unlabeled = false, safe_labels = {"s", "f", "n", "u", "t", "/", "F", "L", "N", "H", "G", "M", "U", "T", "?", "Z"}, labels = {"s", "f", "n", "j", "k", "l", "o", "d", "w", "e", "h", "m", "v", "g", "u", "t", "c", ".", "z", "/", "F", "L", "N", "H", "G", "M", "U", "T", "?", "Z"}, special_keys = {repeat_search = "<enter>", next_match = "<enter>", prev_match = "<tab>", next_group = "<space>", prev_group = "<tab>", eol = "<space>"}}

0 comments on commit 5183894

Please sign in to comment.