binkybear / Android-Terminal-Emulator

A VT-100 terminal emulator for the Android OS
Other
16 stars 13 forks source link

COLUMNS is set to 80 requiring "resize" on terminal start #3

Open jcadduono opened 8 years ago

jcadduono commented 8 years ago

This breaks a lot of ncurses apps.

Probably due to: https://github.com/offensive-security/kali-nethunter/blob/master/nethunter-fs/stages/stage2#L11

Perhaps the terminal emulator should be dynamically adjusting LINES/COLUMNS itself? Or change the stty call to a resize?

binkybear commented 8 years ago

Calls the size: https://github.com/binkybear/Android-Terminal-Emulator/blob/nethunter/term/src/main/java/com/offsec/nhterm/TermService.java#L182

To function (column, rows): https://github.com/binkybear/Android-Terminal-Emulator/blob/nethunter/term/src/main/java/com/offsec/nhterm/BoundSession.java#L31

binkybear commented 8 years ago

https://github.com/binkybear/Android-Terminal-Emulator/commit/5af38a650ff313b578069e427ee86acf8605edf7

binkybear commented 8 years ago

I reverted because it felt to hacky (busybox resize). I went and looked at Termux source code to see how they did it and it was actually what I thought about doing. So I'm somewhat on the right track:

C Code: https://github.com/termux/termux-app/blob/master/app/src/main/jni/termux.c#L181 Library: https://github.com/termux/termux-app/blob/26dcd5af882770ee9380803dad82ae7577dc9a6d/app/src/main/java/com/termux/terminal/JNI.java#L28 Setting size: https://github.com/termux/termux-app/blob/26dcd5af882770ee9380803dad82ae7577dc9a6d/app/src/main/java/com/termux/terminal/TerminalSession.java#L159

Looks like our terminal has the same type:

C Code: https://github.com/jackpal/Android-Terminal-Emulator/blob/master/term/src/main/jni/termExec.cpp#L33 Exec: https://github.com/jackpal/Android-Terminal-Emulator/blob/530dc703a2c9d6065983524084aaa3ddc7da7743/term/src/main/java/jackpal/androidterm/Exec.java#L39