diff --git a/README b/README index 672e99a..44afa92 100644 --- a/README +++ b/README @@ -1,4 +1,3 @@ -================================= BiCon - The Bidirectional Console ================================= @@ -13,7 +12,11 @@ Installation You need the FriBidi library to compile this program. Probably you have it in your distribution. If not, get it from -http://fribidi.org/ +http://fribidi.org/ . You can install it via Homebrew as well (works on both Linux and macOS): + +``` sh +brew install fribidi +``` Installation is simple, the usual steps: @@ -22,6 +25,17 @@ Installation is simple, the usual steps: make make install + +macOS +----- + +Things seem to somewhat work, but: +- The build fails its last step because there is no `psfaddtable` on macOS. This doesn't seem to matter. + - The built binary can be found at `./bicon/bicon.bin`. +- Sometimes programs exit abnormally: `[1] 15104 abort bicon.bin ls`. This also doesn't seem to matter, but you do need to do a `reset` on the terminal after it. + - I have added a test file that triggers this: `bicon.bin cat ./macOS/test.txt` +- Opening a shell with `bicon` seems to work without problems. + Usage ----- @@ -43,6 +57,85 @@ You can use the alt+shift combination to switch keyboard language. Of course, you have a man page bicon(1) to check. +Emacs +----- + +This works for me: + +``` zsh +function bicon-emc() { + bicon.bin --reshape-only emacsclient -t "$@" + reset +} +``` + +Take care not to run this from a shell that is itself running under `bicon`. You need to use this function if you want to do so (you also need the wrappers defined in the [known issues](#Known-Issues) section): + +``` zsh +bicon-emc () { + if isBicon + then + { + ( + emacsclient -t -e "(progn (setq-default bidi-display-reordering nil) (redraw-display))" "$@" + ) + } always { + emacsclient -e "(setq-default bidi-display-reordering t)" + } + return $? + fi + biconm --reshape-only emacsclient -t "$@" + reset +} +``` + +And it will still not be good for editing RTL text, as Emacs is confused by the bidi reversal that `bicon` does. + +Known Issues +------------ + +* Text that is soft-wrapped, is vertically inverted. You can wrap the text yourself using, e.g., `command ggrep -Eo ".{1,100}"`, to avoid this problem. +* `tmux` is somewhat buggy, but still usable. (See the [screenshots](#Screenshots).) +* As the RTL text is changed in order to be displayed correctly, [copying](https://github.com/behdad/bicon/issues/11) it will probably not work as you intend it. +* [Some](https://github.com/behdad/bicon/issues/24) zsh plugins are somewhat incompatible with running under `bicon`: + * zsh-syntax-highlighting + * zdharma/fast-syntax-highlighting + * zsh-users/zsh-autosuggestions + +One workaround is to wrap your invocations of `bicon` in: + +``` sh +biconm () { + BICON_MODE=y bicon.bin "$@" +} +bicon-zsh () { + biconm zsh + reset +} +``` + +Then check if `zsh` is running under `bicon`: + +``` sh +isBicon () { + test -n "$BICON_MODE" +} +if ! isBicon ; then + antibody bundle zdharma/fast-syntax-highlighting # etc +fi +``` + +Screenshots +----------- + +All the screenshots have been taken on iTerm 3.4.4 (macOS). + +![](./readme_images/fd.png) +![](./readme_images/fzf.png) +![](./readme_images/emacs.png) +![](./readme_images/long_text.png) +![](./readme_images/long_text_tmux.png) + Reporting Bugs -------------- diff --git a/README.md b/README.md new file mode 120000 index 0000000..100b938 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +README \ No newline at end of file diff --git a/bicon/pty_spawn.c b/bicon/pty_spawn.c index 21ab737..42d7042 100644 --- a/bicon/pty_spawn.c +++ b/bicon/pty_spawn.c @@ -13,7 +13,13 @@ namely the PSF License Agreement For Python 2.2.3 #include #include #include -#include +#ifdef __APPLE__ + #include + #pragma GCC diagnostic ignored "-Wimplicit-function-declaration" + #pragma GCC diagnostic ignored "-Wreturn-type" +#else + #include +#endif #include #include #include diff --git a/macOS/test.txt b/macOS/test.txt new file mode 100644 index 0000000..16cf988 --- /dev/null +++ b/macOS/test.txt @@ -0,0 +1,44 @@ +مهندسی انرژی.html +مهندسی صنایع.html +مهندسی عمران.html +مهندسی انرژی.json +مهندسی صنایع.json +مهندسی عمران.json +مهندسی مکانیک (پردیس کیش).html +مهندسی هوافضا (پردیس کیش).html +مهندسی مکانیک (پردیس کیش).json +مهندسی هوافضا (پردیس کیش).json +مهندسی مکانیک (پردیس تهران).html +مهندسی مکانیک (پردیس تهران).json +مهندسی فناوری اطلاعات (پردیس تهران).html +مهندسی فناوری اطلاعات (پردیس تهران).json +مهندسی مکانیک.html +مهندسی هوافضا.html +مهندسی مکانیک.json +مهندسی هوافضا.json +مهندسی کامپیوتر (پردیس کیش).html +مهندسی کامپیوتر (پردیس کیش).json +مهندسی کامپیوتر(پردیس تهران).html +مهندسی کامپیوتر(پردیس تهران).json +مهندسی کامپیوتر.html +مهندسی کامپیوتر.json +مهندسی مکاترونیک (پردیس تهران).html +مهندسی مکاترونیک (پردیس تهران).json +مهندسی سیستم?های انرژی.html +مهندسی سیستم?های انرژی.json +مهندسی نانوفناوری (پردیس کیش).html +مهندسی نانوفناوری (پردیس کیش).json +گرافیک(مرکز آموزش مهارتهای مهندسی).html +گرافیک(مرکز آموزش مهارتهای مهندسی).json +زبان?ها و زبان?شناسی (پردیس کیش).html +زبان?ها و زبان?شناسی (پردیس کیش).json +بیوشیمی.html +بیوشیمی.json +پژوهشکده علوم و فن?آوری نانو.html +پژوهشکده علوم و فن?آوری نانو.json +پژوهشکده الکترونيک.html +پژوهشکده الکترونيک.json +پژوهشکده سیاست?گذاری علم، فناوری و صنعت.html +پژوهشکده سیاست?گذاری علم، فناوری و صنعت.json +کارگاه?ها(مرکز آموزش مهارتهای مهندسی).html +کارگاه?ها(مرکز آموزش مهارتهای مهندسی).json \ No newline at end of file diff --git a/readme_images/emacs.png b/readme_images/emacs.png new file mode 100644 index 0000000..fedfba4 Binary files /dev/null and b/readme_images/emacs.png differ diff --git a/readme_images/fd.png b/readme_images/fd.png new file mode 100644 index 0000000..4aaeb95 Binary files /dev/null and b/readme_images/fd.png differ diff --git a/readme_images/fzf.png b/readme_images/fzf.png new file mode 100644 index 0000000..e7887f0 Binary files /dev/null and b/readme_images/fzf.png differ diff --git a/readme_images/long_text.png b/readme_images/long_text.png new file mode 100644 index 0000000..5dfa38b Binary files /dev/null and b/readme_images/long_text.png differ diff --git a/readme_images/long_text_tmux.png b/readme_images/long_text_tmux.png new file mode 100644 index 0000000..cb8c847 Binary files /dev/null and b/readme_images/long_text_tmux.png differ