Skip to content

Commit c2a6a97

Browse files
authored
Merge pull request #32 from hymkor/remove-c-esc
`edit`: Removed `c` and `Esc`
2 parents 85bc72a + 5eff9df commit c2a6a97

File tree

5 files changed

+18
-25
lines changed

5 files changed

+18
-25
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ Supported commands
9595
- `EDIT [tablename [WHERE conditions...]]`
9696
- Start an [editor][csvi] to modify the selected records of the table.
9797
- In the editor, these keys are bound.
98-
- `x` or `d`: set NULL to the current cell
99-
- `ESC` + `y`: Apply changes and exit
100-
- `ESC` + `n`: Discard changes and exit
101-
- `q`: Now equivalent to `ESC`
102-
- `c`: Apply changes and exit (deprecated)
98+
99+
| Key | Bindings
100+
|-------|-----------------------------
101+
|`x`,`d`| Set NULL to the current cell
102+
|`q` | Quit editor with confirmation to apply or discard changes
103+
103104
- Because the EDIT statement automatically generates SQL from data changed in the editor, it may not be able to properly represent SQL data for special types specific to individual databases. If you find it, we would appreciate it if you could [contact us](https://github.com/hymkor/sqlbless/issues/new).
104105
- `HOST command-line`
105106
- Executes an operating system command.

README_ja.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ SQL-Bless は、そうした現場での教訓から生まれた、安全で再
9393
- `EDIT [tablename [WHERE conditions...]]`
9494
- 選択したテーブルのレコードを修正するため [エディタ][csvi] を起動します
9595
- エディタ中では以下のキーが拡張されます
96-
- `x` or `d`: セルに NULL をセットする
97-
- `ESC`+`y`: 変更を適用して終了
98-
- `ESC`+`n`: 修正を破棄して終了
99-
- `q`: `ESC` と等価
100-
- `c`: 変更を適用して終了(廃止予定)
96+
97+
| Key | Bindings
98+
|-------|-----------------------------
99+
|`x`,`d`| セルに NULL をセットする
100+
|`q` | 変更を適用するかを確認してから終了
101+
101102
- EDIT文は、エディターでの変更データから自動で SQL を生成する都合、個々のデータベース固有の特殊な型向けの SQL データをうまく表現できない場合があります。見つかりましたら、[ご連絡](https://github.com/hymkor/sqlbless/issues/new)いただけるとたすかります。
102103
- `HOST command-line`
103104
- OS コマンドを実行します

release_note_en.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Release notes (English)
77
- go-multiline-ny v0.22.3 →v0.22.4
88
- go-readline-ny v1.13.0 → v1.14.1
99
- go-ttyadapter v0.2.0 → v0.3.0
10+
- `edit`: Removed `c` and `Esc`. Use `q` to exit the editor, whether applying changes or not. (#32)
1011

1112
v0.27.2
1213
-------

release_note_ja.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Release notes (Japanese)
77
- go-multiline-ny v0.22.3 →v0.22.4
88
- go-readline-ny v1.13.0 → v1.14.1
99
- go-ttyadapter v0.2.0 → v0.3.0
10+
- `edit`: `c``Esc` を廃止。変更の適用を伴う終了も`q` を使用してください。 (#32)
1011

1112
v0.27.2
1213
-------

spread/view.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,18 @@ func (viewer *Viewer) edit(title string, validate func(*csvi.CellValidatedEvent)
9292
}
9393
}
9494

95-
apply := func(app *csvi.KeyEventArgs) (*csvi.CommandResult, error) {
96-
ch, err := app.MessageAndGetKey("Apply changes and quit ? [y/n] ")
97-
if err == nil && (ch == "y" || ch == "Y") {
98-
io.WriteString(app, "y\n")
99-
applyChange = true
100-
return &csvi.CommandResult{Quit: true}, nil
101-
}
102-
return &csvi.CommandResult{}, nil
103-
}
10495
keymap := map[string]func(*csvi.KeyEventArgs) (*csvi.CommandResult, error){
105-
"\x1B": quit,
106-
"q": quit,
107-
"c": apply,
108-
"x": setNull,
109-
"d": setNull,
96+
"q": quit,
97+
"x": setNull,
98+
"d": setNull,
11099
}
111100
for _, p := range viewer.OnEvents {
112101
keymap[p.Key] = p.Handler
113102
}
114103
cfg := &csvi.Config{
115104
Titles: []string{
116105
toOneLine(title, titlePrefix, titleSuffix),
117-
"ESC+\"y\": Apply changes & quit, ESC+\"n\": Discard changes & quit",
106+
"Press `q` to quit: `y` to apply changes, `n` to discard.",
118107
},
119108
KeyMap: keymap,
120109
OnCellValidated: validate,

0 commit comments

Comments
 (0)