I have a HTML element that contains the text Snow-boarding, the container element doesn't have enough space to fit the text in one line so I need it to break in two.
In Chrome this is done automatically (I guess it assumes it's two words and leaves "Snow-" in the first line and "boarding" in the second).
In Firefox however it just leaves it in one line and it extends beyond the container. I was thinking on using the CSS property "word-wrap", which does break the word, but it doesn't break it in the dash (it leaves "Snow-boardi" in one line and "ng" in the other).
Here's the jsFiddle: http://jsfiddle.net/jSrLb/5/
Any way around this?
Thanks
Related
Within an Ace editor, it is easy to find the number of lines in the edited document with the following:
myEditor.session.getLength();
But languages like JSON or XML can be "folded." That is, children properties or elements can be collapsed so only one single line is displayed for the parent.
Is there a way to get the number of lines actually displayed? Something like the following:
myEditor.session.getVisibleLength();
Note: the ultimate goal is to have an editor that adapts its height on the page to the content it displays (if lines are collapsed, then it should shrink, and if collapsed lines are expanded again, it should increase its height.)
UPDATE: After a user's response, I use the following. This is not the answer to the specific question I asked above, but rather the perfect answer to what I was trying to achieve overall:
const myEditor = ace.edit(elem, {minLines: 5, maxLines: 50});
To automatically change the height of the editor use maxLines option, but don't set it to a very large value as performance depends on the number of displayed lines.
I have started to use tmux and noticed that the lines that seperate the different panes are not entirely straight, instead there are small bumps. I think it might have something to do with the font, my thought is that characters from one "character-field" are overlapping into the next, which creates the little bumps. Does anyone know how I can fix this and get a straight line without bumps?
The font I use: Menlo
example of the bumpy lines
The problem was actually the terminal emulator I used, Alacritty, which lets some characters reach outside of their cell. To solve this issue, I switched to Kitty, which has better support for preventing characters from overflowing into other cells.
Im not sure how to express it so I posted a picture in link below.
It should look like this
Just enter the text on 3 lines like so:
MORE
AT
THE HALL
Then adjust the point sizes, leading, kearning, etc. to create the aesthetic you want.
In this case line 1 and 3 could have full justification.
You can use scaling of the text(as shown in the character panel in attached snapshot) because changing font size also moves the baseline and causes the text to shift downward.
These attributes are also exposed via scripting.
I have a batch file that has been aesthetically formatted to display information center console at variable dimensions. In order to achieve this I have used the echo command followed by a period to produce white-space, or just empty space, above and below the content. See the left side of the picture
This works fine for "frames" that switch once per second, but when I remove the the delay it becomes obvious that each 'echo.' is producing one line of white space at a time, creating a rapid scroll, rather than a seamless transition. See the right side of the picture
[]
I've seen a cmd bouncing ball animation on a DIY website, where one of the commenters used a lot of for loops to produce a box with a ball bouncing inside of it. He managed to avoid the scrolling. But that code looked very complicated. I'm not ready to decipher it. But if there were a way to make command prompt produce two ore more lines of white space simultaneously, rather than procedurally, that would be of more use to me. More specifically the ability to produce, as a single instance of output, a whole block of text would be what I am looking to do.
If you want to print on the same line, use echo -ne with \r, which is the return carriage (ie. Print next character at the beginning of the line). Google it for more information.
If you are trying to add intervals between your prints, you can use sleep.
Animation is done through careful use of \r to start writing the same line(s) over again. This can be done with a single or multiple echos.
I am in the process of writing a text editor. After looking at other text editors I have noticed that a number of them refer to a "soft" versus "hard" wrap. What is the difference? I can't seem to find the answer by searching.
A hard wrap inserts actual line breaks in the text at wrap points, with soft wrapping the actual text is still on the same line but looks like it's divided into several lines.
It's usual for text editors to auto-wrap text into paragraphs with hard newlines, but it's less common for the text to be re-flowed into a nice paragraph if you come back later and edit/add/remove words later on. (You can do this manually in emacs with M-q.)
This is rather annoying, since obsessive compulsive people like me then go back and have to manually re-insert the hard breaks at the appropriate points.
On the other hand, soft wrapping is annoying because most all command line tools use line-based diff-ing (version control is where this becomes most noticeable to me). If you've got a 1/3-page paragraph that's soft wrapped and fix a typo, it's basically impossible to see where the change is in a regular diff output or similar.
soft : The text in the textarea is not wrapped when submitted in a form. This is default
hard : The text in the textarea is wrapped (contains newlines) when submitted in a form. When "hard" is used, the cols attribute must be specified
Reference: W3Schools