How to configure cmdr no line wrap? - conemu

I do not want "cmdr" to wrap lines , even if visible window size is smaller than line size.
How do configure that?

Related

Fix dimensions of cmd window

I am learning C and I would like to change the terminal properties in a given code of mine. I know that to change the dimensions I can easily use system("mode con:cols=80 lines=30");, for example.
But if, when the code is executed, the user wants to change the size of the window he can just go to the edges and do that, my doubt: is there a way for me to make these dimensions static? without being able to increase or decrease the size of the window.

How to make a gtktextview drop to the next row when getting to the border of the window?

I want to make a textview that will output strings that may be multiple rows long, and to divide them when they reach the border of the window. The window is set to non-resizable, so its size is fixed.
I tried to get the column and row numbers and work with these, but each character has a different size in pixels, so while a row full of "m" characters would reach the end of the row with the tenth character, a row of "0" would need about sixteen characters to get to the end of the line.
Any ideas?
It seems that you want to implement line wrapping in a GtkTextView. You don't need to do it yourself, the text view widget already supports line wrapping. To turn it on, call gtk_text_view_set_wrap_mode() with the text view and the appropriate wrap mode, such as GTK_WRAP_CHAR.

Keeping mobile browsers from arbitrarily wrapping text

I have a web page that uses em units to allow it to size automatically to any screen size, so the page displays fairly well on mobile devices. I notice, though, that the iPad and iPhone (those are the only mobile devices I've checked so far) wrap blocks of text wherever they feel like it and this breaks the formatting if I've inserted spaces to line up lines. For example, I might have the text
1. This is the first sentence of some text
that wraps to a second line.
There's a Return at the end of "text." on the first line and then the next line has spaces at the beginning to get "that" to line up under "This." But now if an iPad decides to wrap this text after "some" the formatting is destroyed:
1. This is the first line of some
text that wraps to a second line.
Is there a way to tell mobile browsers to not wrap the text themselves and just honor the Returns in the text?
Thanks
Have you tried wrapping your text in <pre> tags ? it will respect your formatting.
Anyway, having the text reflow is preferable since it can rearrange and adapt to any screen size, there is nothing more annoying than having to scroll to the end of the lines to read the text.
If you want to have greater control of text output you will have to address each screen size individually, so I’d use the media element in CSS so you can apply different style depending on screen size.
google “screen size in css responsive” an you will see lots of resource about it.
Looking at your example text more closely, cold you enter <li> tags? so that the numbering could be placed outside? using list-style in CSS? I mean, if your problem is only with list numberings, maybe that can do it.
Best regards.

Draw text and make it fit inside a rectangle in GDI?

Is there's a function that can draw text and fit it inside a rectangle (the function will make the size of the text smaller as appropriate to make it fit or something).
I checked the parameters for DrawText() but I don't think it supports such a feature.
Maybe you can use GetTextMetrics to check if the text fits inside the rectangle, and if it doesn't, reduce the current font size and repeat the measurement.
GetTextMetrics:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd144941%28v=vs.85%29.aspx
There is no function doing it right away, but your can write your own using DrawText with DT_CALCRECT parameter. This parameter will only calculate size of your text and return it to you. It allows also multi line text and also checks provided maximal width you can allow text to be. So if the output rectangle - as calculated by DrawText is too large, then you must calculate it again but with smaller font, you can speed up calculations by using binary method to find the most appropriate font size.

How do I calculate the required size for a CheckedListBox?

I have written some code to automatically scale a CheckedListBox to its contents using mListBox.ItemHeight and mListBox.CreateGraphics().MeasureString(...).
The output from the string measurements is a bit dubious but what really puzzles me is how much to add for borders and such.
I tried both SystemInformation.Border3DSize (= 2) as well as the difference between ClientSize and Size (= 4).
But taking mListBox.ItemHeight * mListBox.Items.Count + 4 for the height makes it one pixel too small and a scrollbar appears.
For the width it does not work at all because it does not take the size of the checkboxes into account for which I can't seem to find a source.
How should I determine the size of the control?
In cases like this, it is typically easier to set the ClientSize rather than the whole Size. One thing to note about ItemHeight is that it does not include the margins of the item. Using a CheckedListBox with default settings, I had an ItemHeight of 13. But the ItemRectangle property had a height of 15.
So here is what I did. I added 9 items to the CheckedListBox (the first Item was longer than the rest), keeping the default size of the control as set by the designer. Then in the constructor of the form, I set the ClientSize like so:
this.checkedListBox1.ClientSize = new Size(TextRenderer.MeasureText(checkedListBox1.Items[0].ToString(), checkedListBox1.Font).Width + 20, checkedListBox1.GetItemRectangle(0).Height * checkedListBox1.Items.Count);
Notice I used TextRenderer.MeasureText to measure the text. It will typically give you better values than Graphics.MeasureString. By default, TextRenderer included a bit of padding in it's measurement. I also included a 20 pixel padding to account for the checkbox. Anyway, with TextRenderer.MeasureText, and the 20 pixel padding for width, and ItemRectangle * Items.Count for the height, that gave me a CheckedListBox that was sized to its contents without ScrollBars.
EDIT: If item widths vary, it may complicate setting the width, as you'll want to set the width based on the longest item. In this case you'll need to measure each item and keep track of which one was the longest.
EDIT 2: Ok so I dug around in the CheckedListBox source code. They use a default size of 13 plus a 3 pixel padding for the width and height of the checkbox. But, if VisualStyles is enabled, they call CheckBoxRenderer.GetGlyphSize to get the size to use because it takes into account the DPI settings. Most machines are set at 96 DPI so that method will still return a size of (13,13). So when you're measuring the text of the item, you can also pass the Graphics object and a CheckBoxState enum to the CheckBoxRenderer.GetGlyphSize to get a size. I used System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal for the state, but I'm not sure that the state matters. I tried CheckBoxState.MixedDisabled as well and it returned the same size, (13,13).
So to summarize, you can use CheckBoxRenderer to get the size of the checkbox, but you will still probably need to use some padding. This reduces the need for hardcoding a magic number to account for the checkbox. Since the checkbox is drawn and isn't an actual control, its size can't be determined like sizes of controls can.
Here is a link to the source of CheckedListBox. It wouldn't hurt to look at it. Specifically, look at the protected override void OnDrawItem method.
CheckedListBox Source

Resources