diff --git a/src/xdisp.c b/src/xdisp.c
index 01f272033e..5addec900f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -427,6 +427,37 @@ #define IT_DISPLAYING_WHITESPACE(it)					\
 	   && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' '			\
 	       || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))
 
+/* Returns 0 if we can't wrap line at the character, 1 if can only
+   wrap before, 2 if can only wrap after, 3 if can wrap before and
+   after.  */
+static int char_can_wrap(struct it *it)
+{
+  Lisp_Object charpos = make_fixnum (IT_STRING_CHARPOS (*it));
+  Lisp_Object tail = Fget_text_property (charpos, Qcan_wrap, Qnil);
+  for (; CONSP (tail); tail = XCDR (tail))
+    {
+      register Lisp_Object tem = XCAR (tail);
+      if (EQ (Qcan_wrap, tem))
+        {
+          Lisp_Object val = XCDR (tail);
+          if (NILP (val))
+            { return 0; }
+          else if (EQ (Qbefore_only, val))
+            { return 1; }
+          else if (EQ (Qafter_only, val))
+            { return 2; }
+          else if (EQ (Qt, val))
+            { return 3; }
+          else
+            { return 0; }
+        }
+    }
+  return 0;
+}
+
+#define IT_CAN_WRAP_BEFORE(it) (char_can_wrap(it) >= 1)
+#define IT_CAN_WRAP_AFTER(it) (char_can_wrap(it) >= 2)
+
 /* If all the conditions needed to print the fill column indicator are
    met, return the (nonnegative) column number, else return a negative
    value.  */
@@ -9098,7 +9129,10 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 	{
 	  if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
 	    {
-	      if (IT_DISPLAYING_WHITESPACE (it))
+              /* If this character displays a whitespace or the text
+                 property says you can wrap after it, the next one can
+                 wrap.  */
+	      if (IT_DISPLAYING_WHITESPACE (it) || IT_CAN_WRAP_AFTER (it))
 		may_wrap = true;
 	      else if (may_wrap)
 		{
@@ -9249,9 +9283,13 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 			      bool can_wrap = true;
 
 			      /* If we are at a whitespace character
-				 that barely fits on this screen line,
-				 but the next character is also
-				 whitespace, we cannot wrap here.  */
+				 (or a character that allows wrapping
+				 after it) that barely fits on this
+				 screen line, but the next character
+				 is also whitespace (or a character
+				 that forbids wrapping before it), we
+				 cannot wrap here.
+                              */
 			      if (it->line_wrap == WORD_WRAP
 				  && wrap_it.sp >= 0
 				  && may_wrap
@@ -9263,7 +9301,8 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 				  SAVE_IT (tem_it, *it, tem_data);
 				  set_iterator_to_next (it, true);
 				  if (get_next_display_element (it)
-				      && IT_DISPLAYING_WHITESPACE (it))
+				      && (IT_DISPLAYING_WHITESPACE (it)
+                                          || !IT_CAN_WRAP_BEFORE (it)))
 				    can_wrap = false;
 				  RESTORE_IT (it, &tem_it, tem_data);
 				}
@@ -9349,12 +9388,14 @@ #define IT_RESET_X_ASCENT_DESCENT(IT)			\
 		     line.  */
 		  if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)
 		      /* If the character after the one which set the
-			 may_wrap flag is also whitespace, we can't
-			 wrap here, since the screen line cannot be
-			 wrapped in the middle of whitespace.
+			 may_wrap flag is also whitespace (or is a
+			 character that forbids wrapper before it), we
+			 can't wrap here, since the screen line cannot
+			 be wrapped in the middle of whitespace.
 			 Therefore, wrap_it _is_ relevant in that
 			 case.  */
-		      && !(moved_forward && IT_DISPLAYING_WHITESPACE (it)))
+		      && !(moved_forward && (IT_DISPLAYING_WHITESPACE (it)
+                                             || !IT_CAN_WRAP_BEFORE (it))))
 		    {
 		      /* If we've found TO_X, go back there, as we now
 			 know the last word fits on this screen line.  */
@@ -23180,7 +23221,7 @@ #define RECORD_MAX_MIN_POS(IT)					\
 
 	  if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
 	    {
-	      if (IT_DISPLAYING_WHITESPACE (it))
+	      if (IT_DISPLAYING_WHITESPACE (it) || IT_CAN_WRAP_AFTER (it))
 		may_wrap = true;
 	      else if (may_wrap)
 		{
@@ -34231,6 +34272,9 @@ syms_of_xdisp (void)
   DEFSYM (QCfile, ":file");
   DEFSYM (Qfontified, "fontified");
   DEFSYM (Qfontification_functions, "fontification-functions");
+  DEFSYM (Qcan_wrap, "can-wrap");
+  DEFSYM (Qbefore_only, "before-only");
+  DEFSYM (Qafter_only, "after-only");
 
   /* Name of the symbol which disables Lisp evaluation in 'display'
      properties.  This is used by enriched.el.  */
