Compare commits

...

13 Commits

Author SHA1 Message Date
Jorge Morante 9b393e5757 updated CHANGELOG.md 2024-05-02 16:52:38 +02:00
Jorge Morante 27c5512bc2 bump version in shard.yml 2024-05-02 16:52:14 +02:00
Jorge Morante 2996ef2644 fix dev/release script 2024-05-02 16:51:50 +02:00
Jorge Morante 3c7c6a8673 shitty dev/release script 2024-05-02 16:48:45 +02:00
Morantron 03f0048468
Merge pull request #119 from Avimitin/master
put user defined configs to the front of the list
2024-05-02 15:25:51 +02:00
Avimitin 7e693d40cd
put user defined configs to the front of the list
Signed-off-by: Avimitin <dev@avimit.in>
2024-04-29 17:00:09 +08:00
Jorge Morante 4d3fa1eb30 fix blank screen under certain circumstances due to incorrect handling of capture groups 2024-04-05 12:04:33 +02:00
Jorge Morante 47d986b8a2 bump version in shard.yml 2024-03-08 13:36:33 +01:00
Jorge Morante f6813b8b16 update CHANGELOG.md 2024-03-08 13:35:57 +01:00
Jorge Morante 4ba2ec3125 properly restore last pane after invoking fingers 2024-03-08 13:31:32 +01:00
Jorge Morante a30f2fb566 update CHANGELOG.md 2024-01-31 12:47:56 +01:00
Jorge Morante 65a3dd2665 bump version in shard.yml 2024-01-31 12:47:45 +01:00
Jorge Morante c186efa73c Fix "Too many matches" exception in some circumstances
regenerate_hints must be called each time hinter runs
2024-01-31 12:41:52 +01:00
7 changed files with 119 additions and 14 deletions

View File

@ -1,3 +1,16 @@
## 2.1.5 - 02 May 2024
* User defined patterns now take precedence over built-in ones.
* Fix blank screen under certain circumstances due to incorrect handling of capture groups.
## 2.1.4 - 08 Mar 2024
* Fixed "No last pane" error when using "tmux last-pane" ( Fixes #48 )
## 2.1.3 - 31 Jan 2024
* Fix "Too many matches" exception ( fixes #112 ).
## 2.1.2 - 19 Jan 2024
* Added termux support.

77
dev/release.cr Normal file
View File

@ -0,0 +1,77 @@
require "semantic_version"
require "yaml"
struct ShardFile
include YAML::Serializable
include YAML::Serializable::Unmapped
property version : String
end
current_version = SemanticVersion.parse(`shards version`.chomp)
current_branch = `git symbolic-ref --short HEAD`.chomp
pending_changes = `git status -s`.chomp
if current_branch != "develop"
puts "This script should be ran from develop branch"
exit 1
end
if pending_changes != ""
puts "There are uncommited changes"
exit 1
end
puts "Which component you want to bump? major.minor.patch"
print "> "
component = gets
puts "Bumping #{component} in #{current_version}"
next_version = case component
when "major"
current_version.bump_major
when "minor"
current_version.bump_minor
when "patch"
current_version.bump_patch
else
current_version.bump_patch
end
shard = ShardFile.from_yaml(File.read("shard.yml"))
shard.version = next_version.to_s
File.write("shard.yml", shard.to_yaml)
current_date = Time.local.to_s("%d %b %Y")
`git add shard.yml`
`git commit -am "bump version in shard.yml"`
content_to_prepend = "## #{next_version.to_s} - #{current_date}\n\nEDIT THIS:\n\n#{`git log --oneline #{current_version}..@`.chomp}\n\n"
original_content = File.read("CHANGELOG.md")
File.write("CHANGELOG.md", content_to_prepend + original_content)
Process.run(ENV["EDITOR"], args: ["CHANGELOG.md"], input: :inherit, output: :inherit, error: :inherit)
`git add CHANGELOG.md`
`git commit -am 'updated CHANGELOG.md'`
print "Confirm release? [Y/n]\n >"
answer = gets
if answer == "n"
puts "Canceling release"
exit 1
end
`git checkout master`
`git merge develop`
`git tag #{next_version.to_s}`
puts "Run the following command to push the release"
puts ""
puts "git push && git push --tags"

View File

@ -1,13 +1,10 @@
---
version: 2.1.5
name: fingers
version: 2.1.2
authors:
- Jorge Morante <jorge@morante.eu>
- Jorge Morante <jorge@morante.eu>
targets:
tmux-fingers:
main: src/fingers.cr
crystal: 1.11.2
license: MIT

View File

@ -75,8 +75,8 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
end
config.patterns = clean_up_patterns([
*enabled_default_patterns,
*user_defined_patterns,
*enabled_default_patterns,
])
config.alphabet = ::Fingers::Config::ALPHABET_MAP[Fingers.config.keyboard_layout].split("").reject do |char|

View File

@ -26,9 +26,11 @@ module Fingers::Commands
class Start < Base
@original_options : Hash(String, String) = {} of String => String
@last_pane_id : String | Nil
def run
track_options_to_restore!
track_options_to_restore
track_last_pane
show_hints
if Fingers.config.benchmark_mode == "1"
@ -40,7 +42,7 @@ module Fingers::Commands
teardown
end
private def track_options_to_restore!
private def track_options_to_restore
options_to_preserve.each do |option|
value = tmux.get_global_option(option)
@original_options[option] = value
@ -53,6 +55,16 @@ module Fingers::Commands
end
end
private def restore_last_pane
tmux.select_pane(@last_pane_id)
tmux.select_pane(target_pane.pane_id)
end
private def track_last_pane
last_pane_id = tmux.exec("display-message -t '{last}' -p '\#{pane_id}'").chomp
@last_pane_id = last_pane_id unless last_pane_id.empty?
end
private def options_to_preserve
%w[prefix prefix2]
end
@ -94,7 +106,9 @@ module Fingers::Commands
tmux.swap_panes(fingers_pane_id, target_pane.pane_id)
tmux.kill_pane(fingers_pane_id)
restore_last_pane
restore_options
view.run_action if state.result
end

View File

@ -47,7 +47,7 @@ module Fingers
end
def run
regenerate_hints! unless reuse_hints
regenerate_hints!
lines[0..-2].each_with_index { |line, index| process_line(line, index, "\n") }
process_line(lines[-1], lines.size - 1, "")
@ -106,7 +106,7 @@ module Fingers
def replace(match, line_index)
text = match[0]
captured_text = match["match"]? || text
captured_text = captured_text_for_match(match)
relative_capture_offset = relative_capture_offset_for_match(match, captured_text)
absolute_offset = {
@ -114,7 +114,7 @@ module Fingers
match.begin(0) + (relative_capture_offset ? relative_capture_offset[0] : 0)
}
hint = hint_for_text(text)
hint = hint_for_text(captured_text)
build_target(captured_text, hint, absolute_offset)
if !state.input.empty? && !hint.starts_with?(state.input)
@ -129,6 +129,10 @@ module Fingers
)
end
def captured_text_for_match(match)
match["match"]? || match[0]
end
def hint_for_text(text)
return pop_hint! unless reuse_hints
@ -195,7 +199,7 @@ module Fingers
lines.each do |line|
line.scan(pattern) do |match|
match_set.add(match[0]?.not_nil!)
match_set.add(captured_text_for_match(match))
end
end

View File

@ -283,7 +283,7 @@ class Tmux
exec(Process.quote(["display-message", "-d", delay.to_s, msg]))
end
private def exec(cmd)
def exec(cmd)
@sh.exec("#{tmux} #{cmd}")
end
end