Comments (1)
This patch works around the problem by ensuring that insert_more_chars is never called. It forces even terminals with the "IC" capability to use another method to insert characters.
A better solution may be to implement something to call tgoto(). Perhaps using the DL library? I don't know how that affects performance. Any opinions gratefully received.
I don't think that this patch should make it into 0.4.1 so I'll stick the 0.5.0 milestone on it. It works fine for me, but hasn't had nearly enough testing, IMO.
From b2a72308ad7ecdc583492c42006ac1996a7f2c95 Mon Sep 17 00:00:00 2001
From: Mark Somerville <[email protected]>
Date: Fri, 17 Jun 2011 19:23:54 +0100
Subject: [PATCH] Always set @_rl_terminal_can_insert to false
Currently, rb-readline doesn't call the C function tgoto(). Until we can
do that, setting @_rl_terminal_can_insert to false ensures that
insert_some_chars() doesn't get called.
This works around a problem with long(ish) prompts with invisible
characters that sometimes occured when exiting from an i-search. The
problem was evident on gnome-terminal (which has the "IC" capability).
Tested-by: Mark Somerville <[email protected]> [MRI 1.8.7/1.9.2, RBX 1.2.3]
Signed-off-by: Mark Somerville <[email protected]>
---
lib/rbreadline.rb | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/rbreadline.rb b/lib/rbreadline.rb
index 409d0c6..1b0dea1 100644
--- a/lib/rbreadline.rb
+++ b/lib/rbreadline.rb
@@ -807,7 +807,12 @@ module RbReadline
@_rl_term_goto = nil^M
@_rl_term_pc = nil^M
^M
- # Non-zero if we determine that the terminal can do character insertion.^M
+ # "An application program can assume that the terminal can do character^M
+ # insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is^M
+ # provided.". But we can't do anything if only `ip' is provided, so...^M
+ #^M
+ # Currently rb-readline can't tgoto(). Setting this to false means that^M
+ # insert_some_chars doesn't get called and some other method is used.^M
@_rl_terminal_can_insert = false^M
^M
# How to insert characters.^M
@@ -2028,12 +2033,6 @@ module RbReadline
_rl_get_screen_size(tty, 0)^M
end^M
^M
- # "An application program can assume that the terminal can do^M
- # character insertion if *any one of* the capabilities `IC',^M
- # `im', `ic' or `ip' is provided." But we can't do anything if^M
- # only `ip' is provided, so...^M
- @_rl_terminal_can_insert = !!(@_rl_term_IC || @_rl_term_im || @_rl_term_ic)^M
-^M
# Check to see if this terminal has a meta key and clear the capability^M
# variables if there is none.^M
@term_has_meta = !!(tgetflag("km") || tgetflag("MT"))^M
--
1.7.4.4
from rb-readline.
Related Issues (20)
- IRB and readline with non english keyboards on Windows HOT 1
- Alt+. crashes in `_extract_last_quote` when last line is empty
- Already initialized constant warnings under Ruby 2.3.1 HOT 4
- new release HOT 4
- VI in Rails Console HOT 2
- rb-readline (0.5.3) crashes on mac_os_x / 2.3.1p112 HOT 1
- "\r" being displayed after hitting enter in rb-readline on Arch HOT 2
- Invalid byte sequence in UTF-8 when running console HOT 5
- issue deploying rails 5 application to AWS using Elastic Beanstalk due to rb-readline HOT 5
- RbReadline.rl_insert_text can not insert Chinese characters
- Officially support JRuby HOT 2
- ArgumentError when case insensitive matching is active HOT 1
- Add support for Readline.vi_editing_mode? & Readline.emacs_editing_mode? HOT 1
- Tests are randomly failing
- Using rb-readline in Windows with cygwin/mintty/git for Windows doesn't work
- Rb-readline causes the rails console to use the keyboard "↑" after typing Chinese and cannot load Chinese
- Fails when $TERM=xterm HOT 4
- Broken support for special prefixes HOT 1
- `Readline::HISTORY.delete_at(index)` not working for indices of negative values
- Encoding::UndefinedConversionError for UTF-8 to ASCII8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rb-readline.