GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing codemirror.net — CodeMirror Right-to-Left Text Example Example: Right-to-Left TextTo create a basic editor for Arabic or Hebrew text, you only need to
style the editor or some parent document with a Of course, in a code editor context, you will often be dealing with a bunch of Latin syntax or tag names, causing right-to-left text to become heavily bidirectional. Editing mixed-direction text is, by its very nature, somewhat messy and confusing, but CodeMirror tries to make it bearable wherever it can. Cursor motion (as defined in the default keymaps) is visual, meaning that if you press the left arrow your cursor should move left, regardless of the direction of the text at the cursor position. Some other commands work in a logical direction—for example Backspace deletes before the cursor, which is to the left in left-to-right text, and to the right in right-to-left text. Similarly, Delete deletes text after the cursor. When you define custom commands that work in a visual way, you should
check the local text direction,
and use that to determine which way to go (possibly using the
When writing extensions, take care to not assume a left-to-right layout. Either set up your CSS to use direction-aware properties or, if that doesn't work, explicitly check the global editor direction and adjust your behavior to that. Bidi IsolationA common issue with bidirectional programming or markup text is that the standard algorithm for laying the text out associates neutral punctuation characters between two pieces of directional text with the wrong side. See for example this right-to-left HTML code:
Though in the logical text, the Thus, it can be useful to add elements with a Here's an editor has that exention enabled. Note that the HTML tags are shown coherently left-to-right. If you need to isolate ranges using some other mechanism, you can use
decorations to style pieces of code with a
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |