From 661bca534ca42558b2274076d88b557e023026ab Mon Sep 17 00:00:00 2001 From: Jishnu Mohan Date: Tue, 22 Oct 2013 23:38:02 +0530 Subject: [PATCH] Fixes width of line after \n character. When \n character is there in a string, calculation of width for very next line after \n was wrong. This commit fixes issue #23. --- src/ui/backend/canvas/TextFlow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/backend/canvas/TextFlow.js b/src/ui/backend/canvas/TextFlow.js index 450ef25a..07f2e7fd 100644 --- a/src/ui/backend/canvas/TextFlow.js +++ b/src/ui/backend/canvas/TextFlow.js @@ -170,6 +170,7 @@ var TextFlow = exports = Class(PubSub, function (supr) { if (word.word === "\n") { lines.push([{word: s, width: currentWidth, line: lines.length}]); s = ""; + currentWidth = 0; } else { var isLineEmpty = !s.length; var hasSpace = !isLineEmpty && !this._opts.wrapCharacter;