Comments (9)
This might not be entirely supported yet, since the EraseNPreviousChars(n)
function erases N amount of characters at a time. You can see how the backspace function is implemented a few lines down on that file here
ssh-chat/sshd/terminal/terminal.go
Lines 491 to 495 in 0eebb64
I am not super familiar enough with the keyboard I/O code personally, but I don't think ssh-chat is contextually aware of what your user locale is going to be exactly. The server side is responsible for key inputs and rendering the readline functionality, but its probable that ssh-chat doesn't have enough contextual information for each user to be able to do this. To ssh-chat, when you enter a 2-byte character, ssh-chat sees exactly 2-bytes. It doesn't process whether or not that might be a rune, it only handles it at an individual byte level.
from ssh-chat.
Hi @jonnyliang, I'm not able to reproduce this. It may be an issue with your terminal, or compatibility between your terminal and how we handle unicode character width counting:
What terminal are you using? Could you try a modern terminal like kitty or alacritty?
from ssh-chat.
I reproduce it. That is terminal compatibility issue.
In alacritty,it works perfect.
In cmd/powershell/windows temiernal, It will leave char after chinese in buffer(I guess)
(Delete chinese from the end of input)
(Delete chinese from the middle of input.And enf of input " g g" is display after delete)
Versions
Client version: Ubuntu 22.04
Server version:Windows 11
ssh-chat version: 1.10,1.11-rc5
from ssh-chat.
Yea, that's a terminal issue unfortunately, they don't count character width the same way as modern terminals. There's no way to support both.
from ssh-chat.
Hi @jonnyliang, I'm not able to reproduce this. It may be an issue with your terminal, or compatibility between your terminal and how we handle unicode character width counting:
What terminal are you using? Could you try a modern terminal like kitty or alacritty?
You are right, this a terminal issue unfortunately, it will leave half of a char when I using XSHELL 5. it work by using alacritty! thanks!
from ssh-chat.
Yea, that's a terminal issue unfortunately, they don't count character width the same way as modern terminals. There's no way to support both.
By the way, I fixed the problem on my local code as below, it seems work well on alacritty and XSHELL,but I not sure its ok.
//
_, _, left, _ := t.moveCursorToPos(t.pos)
copy(t.line[t.pos:], t.line[n+t.pos:])
t.line = t.line[:len(t.line)-n]
if t.echo {
t.writeLine(t.line[t.pos:])
for i := 0; i < left; i++ {
t.queue(space)
}
t.advanceCursor(left)
....
from ssh-chat.
from ssh-chat.
If you have a patch that fixes this and doesn't break other things, please make a PR and I'll take a look. :)
from ssh-chat.
I just modified content of two functions,Hope for better solution!
ssh-chat/sshd/terminal/terminal.go
func (t *Terminal) moveCursorToPos(pos int) (up, down, left, right int) {
...
return up, down, left, right
}
func` (t *Terminal) eraseNPreviousChars(n int) {
if n == 0 {
return
}
if t.pos < n {
n = t.pos
}
t.pos -= n
//t.moveCursorToPos(t.pos)
//-----------fixed begin------------------------------
up, _, left, _ := t.moveCursorToPos(t.pos)
if left ==0{
if up == 1{left =up}
}
//-----------fixed end------------------------------
copy(t.line[t.pos:], t.line[n+t.pos:])
t.line = t.line[:len(t.line)-n]
if t.echo {
t.writeLine(t.line[t.pos:])
for i := 0; i < left; i++ { // left replace n
t.queue(space)
}
t.advanceCursor(left)
t.moveCursorToPos(t.pos)
}
}
from ssh-chat.
Related Issues (20)
- Send messages on \n and not \r\n HOT 6
- Add system bell support to all messages, not just /msg or /reply's HOT 3
- Unable to start using `--unsafe-passphrase` HOT 1
- fuzzer crash HOT 1
- /op USER remove only works until USER reconnects HOT 1
- server: Support multiple identity private keys
- /back: Needs confirmation message
- Whitelist not applying HOT 10
- "ssh.chat" refuse connection HOT 2
- Latest DoS HOT 7
- 8 Vulnerable Dependences per OWASP Dependency Check HOT 2
- Known bug: ssh rsa negotiation issue HOT 5
- COMMANDS ARE CASE SENSITIVE HOT 5
- bot: Skip motd on connect HOT 2
- bot: Don't include emoji prefixes in DMs
- Emojis still appear in TERM=bot mode private messages HOT 1
- Release v1.11 proper HOT 1
- Couldn't connect with allowlist or get admin HOT 2
- Very stupid question HOT 1
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 ssh-chat.