Compare commits

...

21 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
Jorge Morante cd3241ad42 update CHANGELOG.md 2024-01-19 12:00:51 +01:00
Jorge Morante 05a9ece2d9 bump version in shard.yml 2024-01-19 12:00:40 +01:00
Jorge Morante 1be65bc1dc add arch check when downloading binary 2024-01-19 11:53:46 +01:00
Jorge Morante 26d1f67aa9 bump to crystal 1.11.2 2024-01-19 11:53:13 +01:00
Jorge Morante 7e408344b2 recover safely from hinter exceptions 2024-01-18 11:28:10 +01:00
Jorge Morante 680d801770 cache dir should be at root, logs at tmp 2024-01-12 10:22:34 +01:00
Jorge Morante 8cfc2bd1ad change log path to /tmp/fingers.log and remove /tmp hardcoded path 2024-01-12 09:44:12 +01:00
Jorge Morante 6718322da9 add @fingers-jump-key to README TOC 2023-11-18 10:31:37 +01:00
12 changed files with 144 additions and 30 deletions

View File

@ -1,3 +1,23 @@
## 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.
* Fixes to Fingers::Dirs to remove hardcoded paths. Default log path is now /tmp/fingers.log.
* Updated Crystal version to generate clean ELF executables.
* Improve exception handling when rendering.
## 2.1.1 - 16 Nov 2023
* Fix copy/jump when using special named capture group "match".

View File

@ -74,6 +74,7 @@ $ tmux source-file ~/.tmux.conf
NOTE: for changes to take effect, you'll need to source again your `.tmux.conf` file.
* [@fingers-key](#fingers-key)
* [@fingers-jump-key](#fingers-jump-key)
* [@fingers-patterns-N](#fingers-patterns-N)
* [@fingers-main-action](#fingers-main-action)
* [@fingers-ctrl-action](#fingers-ctrl-action)

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

@ -4,7 +4,6 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PLATFORM=$(uname -s)
action=$1
# set up exit trap
function finish {
exit_code=$?
@ -58,7 +57,11 @@ function install_with_brew() {
function download_binary() {
mkdir -p $CURRENT_DIR/bin
# TODO check architecture
if [[ ! "$(uname -m)" == "x86_64" ]]; then
echo "tmux-fingers binaries are only provided for x86_64 architecture."
exit 1
fi
echo "Getting latest release..."

View File

@ -1,6 +1,2 @@
version: 2.0
shards:
ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.5.0
shards: {}

View File

@ -1,18 +1,10 @@
---
version: 2.1.5
name: fingers
version: 2.1.1
authors:
- Jorge Morante <jorge@morante.eu>
- Jorge Morante <jorge@morante.eu>
targets:
tmux-fingers:
main: src/fingers.cr
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 1.5.0
crystal: 1.9.2
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

@ -5,9 +5,10 @@ require "file_utils"
module Fingers::Dirs
TMUX_PID = (ENV["TMUX"] || ",0000").split(",")[1]
ROOT = Path["/tmp"] / "tmux-#{TMUX_PID}"
TMP = Path[File.dirname(File.tempname)]
LOG_PATH = ROOT / "fingers.log"
ROOT = TMP / "tmux-#{TMUX_PID}"
LOG_PATH = TMP / "fingers.log"
CACHE = ROOT / "tmux-fingers"
CONFIG_PATH = CACHE / "config.json"
SOCKET_PATH = CACHE / "fingers.sock"

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

@ -28,7 +28,13 @@ module Fingers
def render
clear_screen
hide_cursor
hinter.run
begin
hinter.run
rescue e
Log.fatal { e }
request_exit!
end
end
def process_input(input : String)

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