Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 95 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
=================================
BiCon - The Bidirectional Console
=================================

Expand All @@ -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:

Expand All @@ -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
-----

Expand All @@ -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
--------------

Expand Down
1 change: 1 addition & 0 deletions README.md
8 changes: 7 additions & 1 deletion bicon/pty_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ namely the PSF License Agreement For Python 2.2.3
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <pty.h>
#ifdef __APPLE__
#include <util.h>
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
#pragma GCC diagnostic ignored "-Wreturn-type"
#else
#include <pty.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
Expand Down
44 changes: 44 additions & 0 deletions macOS/test.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file added readme_images/emacs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/fd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/fzf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/long_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme_images/long_text_tmux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.