emacs thin cursor on empty line - emacs24

Is there a way to make the emacs cursor a "thinner" bar when it is positioned on an empty line? If the line has whitespace, or text, it should be the default width block cursor. This is for emacs 24.
This is the default cursor behaviour on XEmacs, FWIW.

To change cursor dynamically, depending on the contents of the current line add this to your .emacs:
(defun cursor-shape-hook ()
(if (equal (thing-at-point 'line) "\n") (setq cursor-type 'bar)
(setq cursor-type 'box)))
(add-hook 'post-command-hook 'cursor-shape-hook)
All possibilities for cursor shape are:
nil don't display a cursor
box display a filled box cursor
hollow display a hollow box cursor
bar display a vertical bar cursor with default width
(bar . WIDTH) display a vertical bar cursor with width WIDTH
hbar display a horizontal bar cursor with default height
(hbar . HEIGHT) display a horizontal bar cursor with height HEIGHT
ANYTHING ELSE display a hollow box cursor

Related

Position text in margin relative to paper border

I'm trying to write a macro that positions text in the margin of a LaTeX document. The text should appear in the same line the macro is called. Horizontal text position should be relative to the absolute border of the paper rather than the left side of the text.
I tried with the tabto package using the \tabto* command and then jump back to the location in the text with \tabto*{\TabPrevPos}. This works well but since tabto positions relative to the border of the text the result is different if you are in a list environment or similar.
So the whole command looks similar to:
\newcommand{\sidenote}[1]{%
\tabto*{\sidenoteskip}%
\smash{%
\begin{minipage}[t][1ex][t]{\sidenotewidth}%
\textbf{#1}%
\end{minipage}%
}%
\tabto*{\TabPrevPos}%
}
Does anywone have an idea how I can position the minipage relative to left paper border and jump back to the location where the macro was called?

Truncate middle japanese chacracter uilabel ellipsis center line

I have a issue.
uilabel in cell uicollectionview, i set text for this if text is japanese character or chinese character ellipsis truncate tail have center line position (e.x: Image)
Image issue center line ellipsis
some time ellipsis truncate tail have bottom line position ( e.x: Image)
Image issue bottom line ellipsis

treemap can't render box when containing text that is too large

When creating a treemap structure with boxes, boxes with a text that is larger than the box itself are not drawn.
Below the same treemap is show twice: once with text, once without text.
treemap with text
image without text
How do I prevent this from happening?
I'm pretty sure this can't be prevented. The reason is that the box sizes have hard constraints on their sizes (the size is as meaningful as the height of a bar in a bar chart), so they can't grow with the size of the enclosed text.
To fix this you could generate shorter labels (removing all the vowls and truncating them) and showing the full label as a tooltip? Or you could have a box with a label in it on the side which contains the currently hovered box?

How to align text on elmentary label widget?

I want align text to center on elm_label widget. I can't find any functions about text align as evas object text function or elm_label function. Also, I can't find a function that can get the text size (absolute pixel or relative size) on a label.
I have tried elm_object_style_set with marker, it was showed bold text on center of label, but font size was too small (smaller than default style). (and I don't want bold on text.)
How I can align text to the center of a label?
You can use HTML like markup to customize the way you want to the display the text in elm_label.
To align the text to the center, you can use <align> markup tag with value center .
std::string text = "<align = center> TEXT TO DISPLAY </align>";
Evas_Object *label = elm_label_add(parent);
elm_object_text_set(label,text.c_str());
evas_object_show(label);
You can also use other tags like font_weight, font_style to customize your display text. List of all possible tags can be found here
You can set the alignment of the label through the evas_object API. Likely what you are looking for is:
evas_object_size_hint_align_set(label, 0.5, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
The 0.5 is center, you could try 0.0 for left align and 1.0 for right.

Position of the first line on UILabel

I have 2 UILabels, one which is multi-line and other is of 2 lines. I always have an image besides these labels and its becoming difficult for me to align the image with the text. Eg:
If the 2 line label just has some small text on it, the text is displayed on the middle of the label and the image is aligned with the first line. If it has exactly 2 lines on text on it, then the image is aligned to the first line of text which is exactly what I want.
Is there a way I can get the position or co-ordinates (x,y) of the first line on UILabel so that I can adjust the image constraints accordingly then?
This will give you the co-ordinates and the dimensions:
label.frame.origin.x
label.frame.origin.y
label.frame.size.width
label.frame.size.height

Resources