gitui-org / gitui-org/gitui

UX: Wherever Arrow keys may scroll or switch to other view, switch only if no scroll happened in last 0.5 s

オープン
#2,898 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature-request
主要言語
Rust
スター
22.5k
フォーク
773
PR マージ指標
30日以内にマージされた PR はありません

説明

### The Problem

In a number of views, Arrow keys allow to scroll contents horizontally and/or vertically. Those views include full screen diff (`Up`/`Down`) or commit message body (`Up`/`Down`). However, those views are also left by the same Arrow key if you're at the edge already and press the key once more.

UX wise, this overloading is problematic, because scrolling is often used with autorepeat, which unintendedly runs into the other view too easily.

In the case of the commit message body, there's no way for the user to separate switching from scrolling, other than paying high attention to the tiny scroll bar and slowing down near the end.

In the case of full screen diff, the problem has been [mitigated](https://github.com/gitui-org/gitui/issues/1729#issuecomment-1677802949), for the time being, by _disabling_ `Left` as a way to leave. However, that workaround [comes at a price](#1729) of its own, as it breaks "Lynx mode" navigation.

### Suggested Solution

Wherever a view area can be left by an Arrow key that also is used to scroll that view's content, perform the switch only if there hasn't been any input from the specific key in the last 0.5 s. (Time window may be adjusted.)

This ensures that switching generally works instantly (as opposed to an hard delay), whilst only in conflicting moments there's a barrier that prevents autorepeat from running too far.
In the latter case, simply pressing the key anew suffices to switch views if indeed intended.

### Considered Alternatives

Alternatively, different keys could be bound to scrolling vs. switching by default. However, Arrow keys make a lot of sense for both (even if for mostly distinct user groups).

### Additional Context

This FR is based on a [suggestion](https://github.com/gitui-org/gitui/issues/1729#issuecomment-1824749242) by [@smammy](https://github.com/smammy) on how to safely re-enable Arrow key back navigation in full screen diff.

However, just like the underlying problem, the solution is more general, and should be applied globally to all scrollable views.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、全画面 diff、commit メッセージ本文、その他のスクロール可能なビューでの矢印キーの処理を追跡し、スクロールとビュー切り替えが同じ入力を共有している箇所を特定します。キーごとの 0.5 秒のガードを実装して検証し、オートリピート中のスクロールでナビゲーションがトリガーされないようにすると同時に、新しく押されたキーでは意図したとおりにビューを切り替えられるようにします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
cli
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。