天道酬勤,学无止境

word-wrap

How to find whether text in a text area is wrapped to multiple lines?

How can I find whether a long text in a textarea is wrapped into two or more lines? I'm not talking about the new line chars as discussed here. I'm aware of the plugin Textarea Line Count Any simpler method?

2021-06-24 06:55:36    分类:问答    javascript   jquery   textarea   line-breaks   word-wrap

如何避免在 CSS 浮动中换行(How to avoid wrapping in CSS float)

问题 我有一个并排的 2 列页面(均由 float: left 定义)。 我的问题是,当我将浏览器缩放得更小时,右列将被放到左列下方。 我怎样才能避免这种情况? 无论屏幕大小如何,仍然使它们并排。 谢谢 回答1 使父容器具有固定宽度或将溢出设置为自动。 例如,如果您的两列宽 200px <div style="width: 400px; overflow: auto;"> <div style="float: left; width: 200px;"></div> <div style="float: left; width: 200px;"></div> </div> 回答2 或者,如果您希望它们使用浏览器调整大小,则需要以百分比定义宽度。 所以: .div1 { float:left; width:49%; background:red; } .div2 { float:left; width:49%; background:orange; } 有些人会在这里使用 50%,我倾向于不

2021-06-23 19:03:22    分类:技术分享    html   css   word-wrap   css-float

Check if text in UITextView went to new line due to word wrap

How can I check if the text in a UITextView went to the next line due to word wrap? I currently have code to check if the user enters a new line (from the keyboard). - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; { if ( [text isEqualToString:@"\n"] ) { ... } return YES; }

2021-06-23 14:30:19    分类:问答    objective-c   uitextview   word-wrap

Android TextView text not wrapping within RelativeLayout on version 2.3.3

I have been trying to get a TextView to wrap the text to multiple lines on Android 2.3.3 for a while not but I can't seam to get it working, even on the most basic of levels. No matter what I do the text always just cuts off at the edge of the screen. It works just fine on Android 4 but I would like to target 2.3.3 as well. I have tried just the basic part here: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/mainDescText" android

2021-06-23 11:12:56    分类:问答    android   textview   word-wrap

CSS: Wrap text AND break word if necessary

How can I set up a div such that it will wrap text AND will also break word if necessary? Examples below, with the dots showing the width of the div ("zzzzzzz..." is all one word). .................................... Hello these are words .................................... zzzzzzzzzzzzzzzzzz zzzzzz

2021-06-23 01:12:10    分类:问答    html   css   word-wrap   word-break

使用 StackLayout 进行标签包装(Label wrapping with StackLayout)

问题 我正在使用 Xamarin 并使用 XAML 创建我的视图,但我一生都无法让这个标签按照我想要的方式包装。 如果标签到达屏幕边缘,我希望它像这样包裹...... 现在它看起来像这样...... 这是我的代码: <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" BindingContext="{Binding CurrentProviderDetails}" Padding="20,20,20,20" > <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <!--Certification Board--> <StackLayout Orientation="Horizontal" HorizontalOptions="StartAndExpand" Grid.Row="0" Grid.Column="0" > <Label Text="Certification Board: " FontSize=

2021-06-22 23:27:45    分类:技术分享    xaml   xamarin   label   word-wrap

TextBox Word-Wrapping splitting string to lines

This is my first time posting question on this amazing service, since today it has helped me a lot by just reading it. Currently, I'm making small C# application where I need to use a lot of TextBoxes. In TextBox Properties I have checked MultiLine and Word-Wrap functions. So when user enters text, it is displayed correctly in multiple lines. My problem is how can I get those lines, which are displayed on form, in list of strings, instead of one big string. I haven yet distinguished weather Word-Wrap Function makes new lines or adds "\n\r" at the end of every line. I tried to get lines from

2021-06-22 21:34:28    分类:问答    c#   string   textbox   word-wrap

Calculate how many characters (from a string) will fit into a div without making it wrap?

So I have a <div></div>. I want to know how much (in length) of a string will fit in it before it wraps to the next line. The script should take into account the width of the element (real clientWidth), the left and right margins, and the left and right paddings. <div id="stackoverflow"></div> And JavaScript, assuming the magic function is calculate: calculate("#stackoverflow","the string to be inputed to the div"); // That should either output how much of the string fits in the div // or the string's length if it fits without wrapping. The selector #stackoverflow isn't important, it's just

2021-06-22 10:58:41    分类:问答    javascript   word-wrap

如何禁用 NSTextView 的自动换行?(How to disable word-wrap of NSTextView?)

问题 NSTextView 默认会自动换行。 我怎样才能禁用它? 我正在制作一个 JSON 代码查看器,所以我必须禁用它。 回答1 我从:http://lists.apple.com/archives/cocoa-dev/2008/May/msg02396.html 得到解决方案 您必须将 NSTextView 的最大宽度设置为非常大的数字才能使其正常工作。 (只需复制最大高度)并启用 NSTextView 的超级视图 NSScrollView 的水平滚动。 看这些图片: http://www.flickr.com/photos/47601728@N06/4759470529/ http://www.flickr.com/photos/47601728@N06/4759470533/ 更新 我发现我的旧示例代码不足以使其完全正常工作。 (因为 SDK 版本?)此外,这是我在 OSX 10.8 SDK 中禁用自动换行的完整源代码片段。 [self setMaxSize:CGSizeMake(FLT_MAX, FLT_MAX)]; [self setHorizontallyResizable:YES]; [[self textContainer] setWidthTracksTextView:NO]; [[self textContainer] setContainerSize

2021-06-22 09:56:09    分类:技术分享    cocoa   word-wrap   nstextview

在 Vim 上的不同文件扩展名上自动启用和禁用自动换行(Enabling and disabling word wrap automatically on different file extensions on Vim)

问题 我通常必须阅读长行的 .txt 文件,同时编辑一些源文件,我喜欢在 .txt 文件上看到自动换行,而不是在没有的文件中看到自动换行。 当然我可以 :set wrap 和 :set linebreak ,但是有什么方法可以让它自动并依赖于文件扩展名? 回答1 我猜:autocmd BufNewFile,BufRead *.txt set wrap应该可以解决问题 回答2 我能想到的有两种选择。 首先,您可以按照 Tassos 的建议使用 autocmd: :au BufNewFile,BufRead *.txt set wrap 看: :help autocmd 另一种选择(如果您按照建议进行了多个设置,则可能更适用):在您的 vim 配置文件夹(见下文)的after/ftplugin目录中创建一个名为txt.vim文件,无论何时您都可以获取打开一个.txt文件。 您可以将它放在普通的ftplugin目录中(而不是after/ftplugin ),但它不会加载.txt文件的任何内置设置。 把你想要的任何命令放在这个文件中: " This is txt.vim in the ftplugin directory set wrap set linebreak 看: :help after-directory :help ftplugin Vim 配置文件夹 在 Windows 上

2021-06-22 07:35:42    分类:技术分享    vim   word-wrap   file-extension