This commit is contained in:
Cheney 2015-09-30 16:13:36 +08:00
parent 3ccecf626d
commit 390f0ebb6b
2 changed files with 7 additions and 2 deletions

View File

@ -26,6 +26,7 @@ You can read the source code in [example/main.go](https://github.com/chzyer/read
* Vim mode * Vim mode
* More funny examples * More funny examples
* Support dumb/eterm-color terminal in emacs
# Usage # Usage
@ -139,6 +140,7 @@ for {
`Meta`+`B` means press `Esc` and `n` separately. `Meta`+`B` means press `Esc` and `n` separately.
Users can change that in terminal simulator(i.e. iTerm2) to `Alt`+`B` Users can change that in terminal simulator(i.e. iTerm2) to `Alt`+`B`
Notice: `Meta`+`B` is equals with `Alt`+`B` in windows.
* Shortcut in normal mode * Shortcut in normal mode
@ -210,10 +212,10 @@ Users can change that in terminal simulator(i.e. iTerm2) to `Alt`+`B`
| Windows 10 | - | | Windows 10 | - |
### Notice: ### Notice:
* `Ctrl`+`A` is not working in screen because it used as a control command by default * `Ctrl`+`A` is not working in `screen` because it used as a control command by default
If you test it otherwhere, whether it works fine or not, please let me know! If you test it otherwhere, whether it works fine or not, please let me know!
# Feedback # Feedback
If you have any question, please submit an GitHub Issues and any pull request is welcomed :) If you have any questions, please submit a github issue and any pull requests is welcomed :)

View File

@ -240,6 +240,9 @@ func (r *RuneBuffer) LineCount() int {
func (r *RuneBuffer) IdxLine() int { func (r *RuneBuffer) IdxLine() int {
totalWidth := RunesWidth(r.buf[:r.idx]) + r.PromptLen() totalWidth := RunesWidth(r.buf[:r.idx]) + r.PromptLen()
w := getWidth() w := getWidth()
if w == 0 {
return 0
}
line := totalWidth / w line := totalWidth / w
// if cursor is in last colmun and not any character behind it // if cursor is in last colmun and not any character behind it