import sublime, sublime_plugin

class InsertWhitespaceCommand(sublime_plugin.TextCommand):
    def run(self, edit):

        # Separate out regions to cope with multiple selections
        for region in self.view.sel():

            # get full lines
            lines = self.view.substr(self.view.line(region)).split("\n")
            new_lines = []

            for line in lines:
                new_line = line
                if len(line) < 79:
                    # If a line is shorter than 79 characters, append spaces
                    new_line += " " * (79 - len(line))
                new_lines.append(new_line)

            self.view.replace(edit, region, "\n".join(new_lines))

@@ -7,17 +7,23 @@
  sublime
-,
+%0Aimport
  sublime
@@ -31,16 +31,17 @@
 plugin%0A%0A
+%0A
 class In
@@ -180,16 +180,17 @@
 lections
+.
 %0A       
@@ -240,22 +240,48 @@
   # 
-get full
+Update selection to include whole
  lines
+.
 %0A   
@@ -289,21 +289,22 @@
         
-lines
+region
  = self.
@@ -312,15 +312,82 @@
 iew.
-substr(
+line(region)%0A%0A            # Extract individial lines.%0A            lines = 
 self
@@ -392,28 +392,30 @@
 lf.view.
-line
+substr
 (region)
 ).split(
@@ -406,17 +406,16 @@
 (region)
-)
 .split(%22
@@ -510,16 +510,17 @@
  = line%0A
+%0A
         
@@ -546,16 +546,17 @@
 ) %3C 79:%0A
+%0A
         
@@ -623,16 +623,17 @@
 d spaces
+.
 %0A       
@@ -680,16 +680,17 @@
 (line))%0A
+%0A
         
@@ -725,16 +725,88 @@
 _line)%0A%0A
+            # Replace old selection with new version with extra spaces.%0A
         

Handle multiple lines correctly